Skip to content

build: enforce .editorconfig code style on build - #22

Merged
illia1f merged 1 commit into
mainfrom
build/enforce-code-style
Nov 11, 2026
Merged

illia1f merged 1 commit into
mainfrom
build/enforce-code-style

Conversation

@illia1f

@illia1f illia1f commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Makes the repo's code style a build failure instead of an IDE hint. No public API changes and nothing to release: the packages behave exactly like 1.0.1.

  • Code style in the build: a repo-wide .editorconfig sets style, naming, and diagnostic severities, and EnforceCodeStyleInBuild makes the build report them. With TreatWarningsAsErrors, a violation fails the build.
  • Tests treat warnings as errors: tests/Directory.Build.props no longer turns TreatWarningsAsErrors off. CONTRIBUTING says so and points at dotnet format.
  • Doc file generation repo-wide: GenerateDocumentationFile and the CS1591 suppression move from src/ to the root props, because IDE0005 only reports unused usings on build when doc comments are parsed. Benchmarks suppress CS1573 for partially documented verification records.
  • Cleanup the rules require: unused usings, collection expressions, trailing whitespace, and re-indented stacked foreach loops in benchmark verification. CancellationToken moves last on the internal EventPublishStrategies methods and the private EventPublishCanceledException constructor (CA1068). The public constructor keeps its parameter order under a suppression, since reordering it would break callers.
  • Benchmark buffers: Array.Empty<byte>() became [] in CommandBuffer and ChangeBuffer. The compiler lowers an empty [] for an array target to Array.Empty<T>(), so the measured paths are unchanged.
  • CI: .editorconfig-only changes no longer skip the build.

Validation:

  • dotnet build --no-incremental: 0 warnings, 0 errors.
  • dotnet test: all pass on net462, net8.0, and net10.0. RequestFlow.Tests.Unit ran 1110, 1139, and 1139 tests (2 skipped on net8.0 and net10.0); RequestFlow.Cqrs.Tests.Unit ran 68 on each.
  • dotnet pack -c Release -p:EnablePackageValidation=true -p:PackageValidationBaselineVersion=1.0.1: no compatibility diagnostics for any of the four packages.
  • Not run: benchmarks. BenchmarkDotNet's generated projects inherit the new root props; a --quick run before the next published run confirms they still build.

- Add a repo-wide .editorconfig and set EnforceCodeStyleInBuild. Test projects now treat warnings as errors as well.
- Move GenerateDocumentationFile to the root props: IDE0005 only reports unused usings on build when doc comments are parsed.
- Apply the cleanup the new rules require across src, tests, samples, and benchmarks. The public API is unchanged; package validation against 1.0.1 reports no differences.
- Stop CI from skipping .editorconfig-only changes, since the file now affects the build.
@illia1f
illia1f merged commit a3daa5f into main Nov 11, 2026
1 check passed
@illia1f
illia1f deleted the build/enforce-code-style branch November 11, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant