Problem
There are no static analysis packages or enforced style rules across the solution. The .editorconfig has a max_line_length of 6279 (clearly unintentional), and code style is inconsistent across files.
Fix
1. Add analyzers to Directory.Build.props
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.*" PrivateAssets="all" />
</ItemGroup>
2. Add a .editorconfig at the repo root
root = true
[*.cs]
indent_style = space
indent_size = 4
max_line_length = 120
dotnet_sort_system_directives_first = true
dotnet_style_qualification_for_field = false
csharp_prefer_simple_using_statement = true
3. Add a stylecop.json (optional suppressions)
Configure per-project as needed, e.g. suppress file headers if not wanted.
4. Treat warnings as errors in CI only
In Directory.Build.props:
<PropertyGroup Condition="'$(CI)' == 'true'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
This avoids blocking local builds while enforcing clean CI runs.
Notes
- Fix the
max_line_length = 6279 typo in the existing .editorconfig — should be 120.
- Run
dotnet format to auto-fix trivially correctable style violations before enabling the analyzers.
Acceptance Criteria
Problem
There are no static analysis packages or enforced style rules across the solution. The
.editorconfighas amax_line_lengthof 6279 (clearly unintentional), and code style is inconsistent across files.Fix
1. Add analyzers to
Directory.Build.props2. Add a
.editorconfigat the repo root3. Add a
stylecop.json(optional suppressions)Configure per-project as needed, e.g. suppress file headers if not wanted.
4. Treat warnings as errors in CI only
In
Directory.Build.props:This avoids blocking local builds while enforcing clean CI runs.
Notes
max_line_length = 6279typo in the existing.editorconfig— should be120.dotnet formatto auto-fix trivially correctable style violations before enabling the analyzers.Acceptance Criteria
StyleCop.Analyzersadded toDirectory.Build.props.editorconfigat repo root withmax_line_length = 120dotnet buildproduces 0 new warnings after fixes