Skip to content

test: Adopt TUnit TestGroup and modernize test codebase#335

Merged
samtrion merged 1 commit intomainfrom
test/testgroups
Apr 7, 2026
Merged

test: Adopt TUnit TestGroup and modernize test codebase#335
samtrion merged 1 commit intomainfrom
test/testgroups

Conversation

@samtrion
Copy link
Copy Markdown
Contributor

@samtrion samtrion commented Apr 7, 2026

  • Add NetEvolve.Extensions.TUnit and annotate all test classes with [TestGroup] for improved organization and filtering.
  • Remove legacy region markers and redundant test double/helper code.
  • Update test code to use C# 12 features (e.g., collection expressions, array initializers).
  • Apply minor doc comment and namespace formatting improvements.
  • Simplify and modernize test assertions and resource management.
  • Clean up static using directives and type aliases.
  • Overall, enhance maintainability, readability, and test discoverability.

Summary by CodeRabbit

  • Tests

    • Organized test suite with test grouping attributes across all test categories for improved test discovery and organization
    • Removed code region separators for cleaner test structure
    • Updated async disposal patterns in database connection tests for proper resource cleanup
  • Documentation

    • Updated XML documentation references for better clarity in code comments

- Add NetEvolve.Extensions.TUnit and annotate all test classes with [TestGroup] for improved organization and filtering.
- Remove legacy region markers and redundant test double/helper code.
- Update test code to use C# 12 features (e.g., collection expressions, array initializers).
- Apply minor doc comment and namespace formatting improvements.
- Simplify and modernize test assertions and resource management.
- Clean up static using directives and type aliases.
- Overall, enhance maintainability, readability, and test discoverability.
@samtrion samtrion self-assigned this Apr 7, 2026
@samtrion samtrion requested a review from a team as a code owner April 7, 2026 09:13
@samtrion samtrion requested a review from Spacemonkay April 7, 2026 09:13
@samtrion samtrion added state:ready for merge Indicates that a pull request has been reviewed and approved, and is ready to be merged into the mai type:chore Indicates some housework that needs to be done. labels Apr 7, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2026

Walkthrough

This pull request systematically adds TUnit test group categorization across the test suite by introducing [TestGroup(...)] attributes to test classes, importing NetEvolve.Extensions.TUnit where needed, and making minor documentation/encoding adjustments to production code and test files.

Changes

Cohort / File(s) Summary
Production Code - Documentation & Namespace Updates
src/NetEvolve.Pulse/Dispatchers/PrioritizedEventDispatcher.cs, src/NetEvolve.Pulse/Interceptors/LoggingMessages.cs
Updated XML documentation references in see cref tags and adjusted namespace declarations with UTF-8 BOM prefixes. No logic or control flow changes.
Test Infrastructure - Dispatcher Tests
tests/NetEvolve.Pulse.Tests.Unit/Dispatchers/*, tests/NetEvolve.Pulse.Tests.Unit/EventDispatcherExtensionsTests.cs
Added [TestGroup("Dispatchers")] attributes and using NetEvolve.Extensions.TUnit; imports across dispatcher test classes.
Test Infrastructure - AspNetCore & Service Bus
tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/*, tests/NetEvolve.Pulse.Tests.Unit/AzureServiceBus/*
Added [TestGroup("AspNetCore")] and [TestGroup("AzureServiceBus")] attributes; updated materialization pattern in AzureServiceBusMessageTransportTests from .ToList() to spread operator [.. messages].
Test Infrastructure - Dapr & EntityFramework
tests/NetEvolve.Pulse.Tests.Unit/Dapr/*, tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/*
Added [TestGroup("Dapr")] and [TestGroup("EntityFramework")] attributes; minor test method signature changes (e.g., generic type argument removal in ModelBuilderExtensionsTests).
Test Infrastructure - FluentValidation & HttpCorrelation
tests/NetEvolve.Pulse.Tests.Unit/FluentValidation/*, tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/*
Added [TestGroup("FluentValidation")] and [TestGroup("HttpCorrelation")] attributes with corresponding TUnit imports and UTF-8 BOM additions.
Test Infrastructure - Idempotency & Interceptors
tests/NetEvolve.Pulse.Tests.Unit/IdempotencyExtensionsTests.cs, tests/NetEvolve.Pulse.Tests.Unit/Interceptors/*
Added [TestGroup("Idempotency")] and [TestGroup("Interceptors")] attributes; removed #region/#endregion blocks in several interceptor test files; updated lambda parameter naming in PollyEventInterceptorTests.
Test Infrastructure - Internals & Kafka
tests/NetEvolve.Pulse.Tests.Unit/Internals/*, tests/NetEvolve.Pulse.Tests.Unit/Kafka/*
Added [TestGroup("Internals")] and [TestGroup("Kafka")] attributes; UTF-8 BOM prefixes on namespace declarations.
Test Infrastructure - Logging, Handler Registration & Query Caching
tests/NetEvolve.Pulse.Tests.Unit/LoggingExtensionsTests.cs, tests/NetEvolve.Pulse.Tests.Unit/HandlerRegistrationExtensionsTests.cs, tests/NetEvolve.Pulse.Tests.Unit/QueryCachingExtensionsTests.cs
Added [TestGroup("Logging")], [TestGroup("HandlerRegistration")], and [TestGroup("QueryCaching")] attributes with TUnit imports.
Test Infrastructure - Outbox
tests/NetEvolve.Pulse.Tests.Unit/Outbox/*
Added [TestGroup("Outbox")] attributes across all outbox test classes; removed extensive #region/#endregion block separators without changing test logic or assertions.
Test Infrastructure - Polly, PostgreSQL & RabbitMQ
tests/NetEvolve.Pulse.Tests.Unit/Polly/*, tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/*, tests/NetEvolve.Pulse.Tests.Unit/RabbitMQ/*
Added [TestGroup("Polly")], [TestGroup("PostgreSql")], and [TestGroup("RabbitMQ")] attributes; updated static using imports in PostgreSQL and RabbitMQ option extension tests to remove global:: qualifiers.
Test Infrastructure - SQLite, SQL Server & Service Collection
tests/NetEvolve.Pulse.Tests.Unit/SQLite/*, tests/NetEvolve.Pulse.Tests.Unit/SqlServer/*, tests/NetEvolve.Pulse.Tests.Unit/ServiceCollectionExtensionsTests.cs
Added [TestGroup("SQLite")] and [TestGroup("SqlServer")] attributes; updated using directives to remove global:: prefixes; replaced new[] array syntax with collection literals [...]; changed using to await using for SqlConnection disposal in SQL Server tests.
Supporting Changes
Multiple test files
UTF-8 BOM prefix additions to namespace declarations across various test files (cosmetic encoding change, no functional impact).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Test groups now clearly labeled, TUnit's way,
Attributes decorating classes day by day,
Dispatchers, outbox, Kafka's path so clear,
Organization blooming without fear!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.19% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the primary changes: adopting TUnit TestGroup attributes and modernizing the test codebase with contemporary C# features.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.21%. Comparing base (602ae40) to head (41d6461).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #335   +/-   ##
=======================================
  Coverage   71.21%   71.21%           
=======================================
  Files         105      105           
  Lines        3787     3787           
  Branches      338      338           
=======================================
  Hits         2697     2697           
  Misses       1016     1016           
  Partials       74       74           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/HttpCorrelationExtensionsTests.cs (1)

14-14: Consider adding SuppressMessage attribute for consistency.

Other test classes in this PR (e.g., HttpCorrelationEventInterceptorTests, HttpCorrelationRequestInterceptorTests) include a [SuppressMessage("IDisposableAnalyzers.Correctness", "CA2000:Dispose objects before losing scope", ...)] attribute. This class also creates ServiceProvider instances without explicit disposal (lines 29, 43, 112, 128). Adding the same suppression would maintain consistency and silence potential analyzer warnings.

♻️ Suggested addition
 using TUnit.Core;

+[SuppressMessage(
+    "IDisposableAnalyzers.Correctness",
+    "CA2000:Dispose objects before losing scope",
+    Justification = "ServiceProvider instances are short-lived within test methods"
+)]
 [TestGroup("HttpCorrelation")]
 public sealed class HttpCorrelationExtensionsTests

You'll also need to add the using directive if not already present via global usings:

using System.Diagnostics.CodeAnalysis;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/HttpCorrelationExtensionsTests.cs`
at line 14, Add a SuppressMessage attribute to the
HttpCorrelationExtensionsTests class to match other tests: annotate the class
HttpCorrelationExtensionsTests with
[SuppressMessage("IDisposableAnalyzers.Correctness", "CA2000:Dispose objects
before losing scope", Justification = "Test creates ServiceProvider instances
that are not disposed in test harness")] and ensure the
System.Diagnostics.CodeAnalysis using is present (or available via global
usings) so the attribute compiles; target the same analysis category and rule
used in HttpCorrelationEventInterceptorTests and
HttpCorrelationRequestInterceptorTests for consistency.
tests/NetEvolve.Pulse.Tests.Unit/RabbitMQ/RabbitMqExtensionsTests.cs (1)

1-1: Consider whether the UTF-8 BOM is necessary.

The UTF-8 Byte Order Mark (BOM) character () before the namespace declaration is generally unnecessary in modern C# projects. While it doesn't break compilation, it can cause issues with some tools and may appear as unexpected characters in certain editors.

If this is being applied consistently across the codebase for a specific tooling requirement, it's fine. Otherwise, standard UTF-8 without BOM is the typical convention.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/NetEvolve.Pulse.Tests.Unit/RabbitMQ/RabbitMqExtensionsTests.cs` at line
1, Remove the leading UTF-8 BOM character before the namespace declaration in
the file containing namespace NetEvolve.Pulse.Tests.Unit.RabbitMQ; open that
test file and delete the invisible BOM character at the top so the file is saved
as plain UTF-8 (no BOM), then re-save and commit the change to avoid
tooling/editor issues.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/NetEvolve.Pulse/Interceptors/LoggingMessages.cs`:
- Line 1: The file contains a UTF-8 Byte Order Mark (BOM) at the start which
should be removed; open src/NetEvolve.Pulse/Interceptors/LoggingMessages.cs
(namespace NetEvolve.Pulse.Interceptors / file LoggingMessages.cs) and re-save
the file as UTF-8 without BOM (e.g., using your editor’s “Save with Encoding” →
UTF-8 without BOM or run a script to strip the BOM), then ensure other affected
C# files are saved the same way and commit the changes so diffs/tooling no
longer include the BOM.

---

Nitpick comments:
In
`@tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/HttpCorrelationExtensionsTests.cs`:
- Line 14: Add a SuppressMessage attribute to the HttpCorrelationExtensionsTests
class to match other tests: annotate the class HttpCorrelationExtensionsTests
with [SuppressMessage("IDisposableAnalyzers.Correctness", "CA2000:Dispose
objects before losing scope", Justification = "Test creates ServiceProvider
instances that are not disposed in test harness")] and ensure the
System.Diagnostics.CodeAnalysis using is present (or available via global
usings) so the attribute compiles; target the same analysis category and rule
used in HttpCorrelationEventInterceptorTests and
HttpCorrelationRequestInterceptorTests for consistency.

In `@tests/NetEvolve.Pulse.Tests.Unit/RabbitMQ/RabbitMqExtensionsTests.cs`:
- Line 1: Remove the leading UTF-8 BOM character before the namespace
declaration in the file containing namespace
NetEvolve.Pulse.Tests.Unit.RabbitMQ; open that test file and delete the
invisible BOM character at the top so the file is saved as plain UTF-8 (no BOM),
then re-save and commit the change to avoid tooling/editor issues.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c51dbc14-50a9-41e0-a075-5b7bb8a9eff8

📥 Commits

Reviewing files that changed from the base of the PR and between 29a795a and 41d6461.

📒 Files selected for processing (78)
  • src/NetEvolve.Pulse/Dispatchers/PrioritizedEventDispatcher.cs
  • src/NetEvolve.Pulse/Interceptors/LoggingMessages.cs
  • tests/NetEvolve.Pulse.Tests.Unit/ActivityMetricsExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/AspNetCore/EndpointRouteBuilderExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/AssemblyScanningExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/AzureServiceBus/AzureServiceBusExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/AzureServiceBus/AzureServiceBusMessageTransportTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Dapr/DaprExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Dapr/DaprMessageTransportTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Dispatchers/ParallelEventDispatcherTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Dispatchers/PrioritizedEventDispatcherTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Dispatchers/RateLimitedEventDispatcherTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Dispatchers/SequentialEventDispatcherTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkOutboxManagementTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkOutboxRepositoryTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkOutboxTransactionScopeTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/ModelBuilderExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/OutboxMessageConfigurationFactoryTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/OutboxMessageConfigurationMetadataTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/TypeValueConverterTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EventDispatcherExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/FluentValidation/FluentValidationExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/FluentValidation/Interceptors/FluentValidationRequestInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/HandlerRegistrationExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/HttpCorrelationExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/Interceptors/HttpCorrelationEventInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/Interceptors/HttpCorrelationRequestInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/HttpCorrelation/Interceptors/HttpCorrelationStreamQueryInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/IdempotencyExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/ActivityAndMetricsEventInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/ActivityAndMetricsRequestInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/ActivityAndMetricsStreamQueryInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/DistributedCacheQueryInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/IdempotencyCommandInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/LoggingEventInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/LoggingInterceptorOptionsValidatorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/LoggingRequestInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Interceptors/TimeoutRequestInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Internals/MediatorBuilderTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Internals/PulseMediatorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Kafka/KafkaExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Kafka/KafkaMessageTransportTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/LoggingExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Outbox/ExponentialBackoffTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Outbox/InMemoryMessageTransportTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxEventHandlerTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxProcessorHostedServiceTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Outbox/OutboxStatisticsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Polly/Interceptors/PollyEventInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Polly/Interceptors/PollyRequestInterceptorTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/Polly/PollyExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlOutboxManagementTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlOutboxOptionsExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlOutboxRepositoryTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlOutboxTransactionScopeTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/QueryCachingExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/RabbitMQ/RabbitMqExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/RabbitMQ/RabbitMqMessageTransportTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteOutboxManagementDatabaseTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteOutboxManagementTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteOutboxOptionsExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteOutboxRepositoryDatabaseTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteOutboxRepositoryTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteOutboxTransactionScopeTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/ServiceCollectionExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerOutboxManagementTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerOutboxOptionsExtensionsTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerOutboxRepositoryTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerOutboxTransactionScopeTests.cs

@@ -1,4 +1,4 @@
namespace NetEvolve.Pulse.Interceptors;
namespace NetEvolve.Pulse.Interceptors;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check for UTF-8 BOM in C# source files

# Find all C# files with BOM (EF BB BF byte sequence)
echo "=== C# files with UTF-8 BOM ==="
fd -e cs -x bash -c 'if [ "$(head -c 3 "{}" | od -An -tx1 | tr -d " ")" = "efbbbf" ]; then echo "{}"; fi'

echo ""
echo "=== Total count ==="
fd -e cs -x bash -c 'if [ "$(head -c 3 "{}" | od -An -tx1 | tr -d " ")" = "efbbbf" ]; then echo "1"; fi' | wc -l

Repository: dailydevops/pulse

Length of output: 16944


🏁 Script executed:

#!/bin/bash
# Check for UTF-8 BOM in C# files using Python
python3 << 'EOF'
import os
import glob

# Find all C# files
csharp_files = glob.glob('**/*.cs', recursive=True)

# Check for BOM (first 3 bytes: EF BB BF)
bom_files = []
target_file = 'src/NetEvolve.Pulse/Interceptors/LoggingMessages.cs'

for filepath in csharp_files:
    try:
        with open(filepath, 'rb') as f:
            first_bytes = f.read(3)
            if first_bytes == b'\xef\xbb\xbf':
                bom_files.append(filepath)
    except:
        pass

print("=== C# files with UTF-8 BOM ===")
if bom_files:
    for f in sorted(bom_files):
        print(f)
else:
    print("(none found)")

print(f"\n=== Total count: {len(bom_files)} ===")

# Specifically check the target file
print(f"\n=== Checking target file: {target_file} ===")
if os.path.exists(target_file):
    with open(target_file, 'rb') as f:
        first_bytes = f.read(3)
        has_bom = first_bytes == b'\xef\xbb\xbf'
        print(f"Has BOM: {has_bom}")
        print(f"First bytes (hex): {first_bytes.hex()}")
        print(f"First 50 chars: {first_bytes + open(target_file, 'rb').read(50)[:47]}")
else:
    print(f"File not found")
EOF

Repository: dailydevops/pulse

Length of output: 11349


Remove UTF-8 BOM from C# files across the codebase.

UTF-8 Byte Order Marks (BOMs) have been added to 159 C# files including this one. BOMs are unnecessary for C# source files and cause issues with tooling, version control diffs, and cross-platform compatibility. Remove the BOM from all affected files.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/NetEvolve.Pulse/Interceptors/LoggingMessages.cs` at line 1, The file
contains a UTF-8 Byte Order Mark (BOM) at the start which should be removed;
open src/NetEvolve.Pulse/Interceptors/LoggingMessages.cs (namespace
NetEvolve.Pulse.Interceptors / file LoggingMessages.cs) and re-save the file as
UTF-8 without BOM (e.g., using your editor’s “Save with Encoding” → UTF-8
without BOM or run a script to strip the BOM), then ensure other affected C#
files are saved the same way and commit the changes so diffs/tooling no longer
include the BOM.

@samtrion samtrion merged commit 94b56b2 into main Apr 7, 2026
12 checks passed
@samtrion samtrion deleted the test/testgroups branch April 7, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:ready for merge Indicates that a pull request has been reviewed and approved, and is ready to be merged into the mai type:chore Indicates some housework that needs to be done.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant