From a79e507a7320d098d1a229eeb2f3e2c1b1e9a3cc Mon Sep 17 00:00:00 2001 From: Maxwell Weru Date: Tue, 27 Feb 2024 10:28:29 +0300 Subject: [PATCH] Add codespell workflow (replaces misspell) --- .codespellrc | 2 ++ .github/workflows/codespell.yml | 21 +++++++++++++++++++ .github/workflows/misspell.yml | 20 ------------------ .../AzureEventHubsTransport.cs | 8 +++---- .../MandatoryEventBusConfiguratorTests.cs | 4 ++-- 5 files changed, 29 insertions(+), 26 deletions(-) create mode 100644 .codespellrc create mode 100644 .github/workflows/codespell.yml delete mode 100644 .github/workflows/misspell.yml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..20103971 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,2 @@ +[codespell] +skip = .git diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..df18e8f6 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,21 @@ +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.github/workflows/misspell.yml b/.github/workflows/misspell.yml deleted file mode 100644 index cdcb9806..00000000 --- a/.github/workflows/misspell.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: misspell - -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * 4' - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: sobolevn/misspell-fixer-action@0.1.0 - - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: 'Fixes by misspell-fixer' - title: 'Typos fix by misspell-fixer' diff --git a/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs b/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs index 2931dc45..feda0b29 100644 --- a/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs +++ b/src/Tingle.EventBus.Transports.Azure.EventHubs/AzureEventHubsTransport.cs @@ -166,7 +166,7 @@ protected override async Task StopCoreAsync(CancellationToken cancellationToken) } using var scope = CreateScope(); - var datas = new List(); + var eventDatas = new List(); foreach (var @event in events) { var body = await SerializeAsync(scope: scope, @@ -192,16 +192,16 @@ protected override async Task StopCoreAsync(CancellationToken cancellationToken) .AddIfNotDefault(MetadataNames.EventName, registration.EventName) .AddIfNotDefault(MetadataNames.EventType, registration.EventType.FullName) .AddIfNotDefault(MetadataNames.ActivityId, Activity.Current?.Id); - datas.Add(data); + eventDatas.Add(data); } // get the producer and send the events accordingly var producer = await GetProducerAsync(reg: registration, deadletter: false, cancellationToken: cancellationToken).ConfigureAwait(false); Logger.SendingEvents(events: events, eventHubName: producer.EventHubName, scheduled: scheduled); - await producer.SendAsync(datas, cancellationToken).ConfigureAwait(false); + await producer.SendAsync(eventDatas, cancellationToken).ConfigureAwait(false); // return the sequence numbers - return scheduled != null ? datas.Select(m => new ScheduledResult(id: m.SequenceNumber, scheduled: scheduled.Value)).ToList() : null; + return scheduled != null ? eventDatas.Select(m => new ScheduledResult(id: m.SequenceNumber, scheduled: scheduled.Value)).ToList() : null; } /// diff --git a/tests/Tingle.EventBus.Tests/Configurator/MandatoryEventBusConfiguratorTests.cs b/tests/Tingle.EventBus.Tests/Configurator/MandatoryEventBusConfiguratorTests.cs index 1ebf9bdc..b517f65e 100644 --- a/tests/Tingle.EventBus.Tests/Configurator/MandatoryEventBusConfiguratorTests.cs +++ b/tests/Tingle.EventBus.Tests/Configurator/MandatoryEventBusConfiguratorTests.cs @@ -44,7 +44,7 @@ public void ConfigureSerializer_Throws_InvalidOperationException() [InlineData(typeof(TestEvent1), true, "dev", NamingConvention.KebabCase, "dev-tingle-event-bus-tests-configurator-test-event1")] [InlineData(typeof(TestEvent1), true, "dev", NamingConvention.SnakeCase, "dev_tingle_event_bus_tests_configurator_test_event1")] [InlineData(typeof(TestEvent1), true, "dev", NamingConvention.DotCase, "dev.tingle.event.bus.tests.configurator.test.event1")] - // Overriden by attribute + // Overridden by attribute [InlineData(typeof(TestEvent2), true, "dev", NamingConvention.KebabCase, "sample-event")] [InlineData(typeof(TestEvent2), true, "dev", NamingConvention.SnakeCase, "sample-event")] [InlineData(typeof(TestEvent2), true, "dev", NamingConvention.DotCase, "sample-event")] @@ -105,7 +105,7 @@ public void ConfigureEventName_Works(Type eventType, bool useFullTypeNames, stri [InlineData(typeof(TestEvent1), typeof(TestConsumer1), true, "service1", ConsumerNameSource.PrefixAndTypeName, NamingConvention.DotCase, "service1.tingle.event.bus.tests.configurator.test.consumer1")] - // Overriden by attribute + // Overridden by attribute [InlineData(typeof(TestEvent2), typeof(TestConsumer2), false, null, ConsumerNameSource.TypeName, NamingConvention.SnakeCase, "sample-consumer")] [InlineData(typeof(TestEvent2), typeof(TestConsumer2), false, null, ConsumerNameSource.Prefix, NamingConvention.SnakeCase, "sample-consumer")] [InlineData(typeof(TestEvent2), typeof(TestConsumer2), false, "service1", ConsumerNameSource.PrefixAndTypeName, NamingConvention.SnakeCase, "sample-consumer")]