StyleBro.Analyzers
0.1.0-alpha.5
See the version list below for details.
dotnet add package StyleBro.Analyzers --version 0.1.0-alpha.5
NuGet\Install-Package StyleBro.Analyzers -Version 0.1.0-alpha.5
<PackageReference Include="StyleBro.Analyzers" Version="0.1.0-alpha.5"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="StyleBro.Analyzers" Version="0.1.0-alpha.5" />
<PackageReference Include="StyleBro.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add StyleBro.Analyzers --version 0.1.0-alpha.5
#r "nuget: StyleBro.Analyzers, 0.1.0-alpha.5"
#:package StyleBro.Analyzers@0.1.0-alpha.5
#addin nuget:?package=StyleBro.Analyzers&version=0.1.0-alpha.5&prerelease
#tool nuget:?package=StyleBro.Analyzers&version=0.1.0-alpha.5&prerelease
StyleBro
Roslyn analyzers and code fixes that keep C# code tidy. It's a modern alternative to StyleCop, built so that dotnet format fixes everything it reports.
StyleCop writes you a ticket. StyleBro just fixes it. Rule IDs use the
BROprefix.
Principles
- Every rule has a code fix, and Fix All works. Fixes are written for
dotnet format: deterministic, idempotent, and they converge in a single pass. CI checks this with a seconddotnet format --verify-no-changesrun. - Don't duplicate the SDK. If a built-in
IDErule already covers a StyleCop rule, the preset enables that rule instead of shipping a copy. - Configurable through
.editorconfig, with a recommended preset shipped as a low-priority global config.
Rules
| ID | Title | Replaces | Fix |
|---|---|---|---|
| BRO1001 | Members should be ordered | SA1201-SA1204, SA1214 | Yes, with custom Fix All |
| BRO1002 | Single-line comments should begin with a space | SA1005 | Yes |
| BRO1101 | Code should not contain empty statements | SA1106 | Yes |
| BRO1102 | Each attribute should be in its own brackets | SA1133 | Yes |
| BRO1103 | Constants should be on the right-hand side of comparisons | SA1131 | Yes |
| BRO1104 | Use default instead of a value type's default constructor | SA1129 | Yes |
| BRO1105 | Constructor initializers should be on their own line | SA1128 | Yes |
| BRO1106 | Use string.Empty for empty strings | SA1122 | Yes |
| BRO1107 | Split parameters should start on the line after the declaration | SA1116 | Yes |
| BRO1108 | Parameters should be on the same line or on separate lines | SA1117 | Yes |
| BRO1109 | Opening parenthesis or bracket should be on the declaration line | SA1110 | Yes |
| BRO1110 | Closing parenthesis or bracket should be on the line of the last item | SA1111 | Yes |
| BRO1111 | Generic type constraints should be on their own line | SA1127 | Yes |
| BRO1112 | Do not use regions (off in the preset, like StyleCop) | SA1124 | Yes |
| BRO1113 | Regions should not be placed inside code elements | SA1123 | Yes |
| BRO1301 | Variable names should begin with a lower-case letter | SA1312 | Yes |
| BRO1302 | Parameter names should begin with a lower-case letter | SA1313 | Yes |
| BRO1303 | Private field names should be camelCase | SA1306, SA1309 | Yes |
| BRO1304 | Interface names should begin with I | SA1302 | Yes |
| BRO1305 | Type parameter names should begin with T | SA1314 | Yes |
| BRO1306 | Constant, static readonly and non-private field names should be PascalCase | SA1303, SA1304, SA1307, SA1311 | Yes |
| BRO1307 | Field names should not begin with a prefix | SA1308 | Yes |
| BRO1308 | Field names should not contain an underscore | SA1310 | Yes |
| BRO1309 | Element names should begin with an upper-case letter | SA1300 | Yes |
| BRO1401 | Use a trailing comma in multi-line initializers | SA1413 | Yes |
| BRO1601 | Overrides and implementations should inherit their documentation | SA1600 (these members) | Yes |
| BRO1602 | Single-line comments should not use documentation style slashes | SA1626 | Yes |
| BRO1603 | Documentation text should end with a period | SA1629 | Yes |
| BRO1604 | Property summary documentation should match accessors | SA1623 | Yes |
| BRO1605 | Property summary documentation should omit accessor with restricted access | SA1624 | Yes |
| BRO1606 | Constructor summary documentation should begin with standard text | SA1642 | Yes |
| BRO1607 | Destructor summary documentation should begin with standard text | SA1643 | Yes |
| BRO1608 | Void return value should not be documented | SA1617 | Yes |
| BRO1609 | Do not use placeholder elements | SA1651 | Yes |
| BRO1610 | Documentation text should not be empty | SA1627 | Yes |
| BRO1611 | Element parameter documentation should match element parameters | SA1612 | Yes |
| BRO1501 | Opening braces should not be preceded by a blank line | SA1509 | Yes |
| BRO1502 | Chained blocks should not be preceded by a blank line | SA1510 | Yes |
| BRO1503 | Opening braces should not be followed by a blank line | SA1505 | Yes |
| BRO1504 | Single-line comments should be preceded by a blank line | SA1515 | Yes |
| BRO1505 | Elements should be separated by a blank line | SA1516 | Yes |
| BRO1506 | Single-line comments should not be followed by a blank line | SA1512 | Yes |
| BRO1507 | Files should not end with blank lines | SA1518 | Yes |
How every StyleCop rule maps to StyleBro or the SDK: docs/stylecop-mapping.md. The rules StyleBro doesn't cover, why, and what it would take to add them: docs/skipped-rules.md. Where the preset and the rules differ from StyleCop's defaults, and how to get StyleCop's behavior back: docs/differences-from-stylecop.md.
Usage
<PackageReference Include="StyleBro.Analyzers" Version="0.1.0-alpha.4" PrivateAssets="all" />
dotnet format # whitespace + style + analyzers, including StyleBro
dotnet format analyzers --diagnostics BRO1001
To opt out of the preset and configure everything yourself: <StyleBroPreset>none</StyleBroPreset>.
Migrating from StyleCop
stylebro-migrate reads a repository's StyleCop setup (rulesets, global configs, .editorconfig files,
stylecop.json) and writes matching StyleBro and SDK settings into its .editorconfig files, so the switch doesn't
reformat code StyleCop was happy with. It also carries #pragma warning disable SA… and [SuppressMessage]
suppressions over to the replacing rules, and lists the StyleCop rules nothing enforces any more.
dotnet tool install --global StyleBro.Migrate --prerelease, then stylebro-migrate path/to/repo. See
docs/migrating.md.
Repository layout
src/StyleBro.Analyzers netstandard2.0, Microsoft.CodeAnalysis.CSharp only (no Workspaces, RS1038)
src/StyleBro.CodeFixes netstandard2.0, code fixes + Fix All providers
src/StyleBro.Package packs both DLLs into analyzers/dotnet/cs + build/ preset
src/StyleBro.Migrate stylebro-migrate: StyleCop setup -> .editorconfig settings
tests/StyleBro.Tests Microsoft.CodeAnalysis.Testing: diagnostics, single fix, Fix All, idempotence
samples/Messy dotnet format integration sample (Input -> Expected)
scripts/verify-format.ps1
Developing
dotnet test tests/StyleBro.Tests
pwsh scripts/verify-format.ps1
dotnet pack src/StyleBro.Package -c Release -o artifacts
Roslyn is pinned to 4.8.0 so the package loads in the .NET 8 SDK / VS 17.8 and newer.
Roadmap
- More StyleCop rules with safe fixes (the candidates in docs/skipped-rules.md)
- Baseline support: fail only on new violations in legacy codebases
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.8.0-alpha.1 | 3 | 10/19/2026 |
| 0.7.0-alpha.1 | 2,939 | 10/13/2026 |
| 0.6.0-alpha.1 | 81 | 10/12/2026 |
| 0.5.0-alpha.1 | 6,377 | 10/10/2026 |
| 0.4.0-alpha.1 | 81 | 10/10/2026 |
| 0.3.0-alpha.1 | 80 | 10/9/2026 |
| 0.2.0-alpha.1 | 122 | 10/6/2026 |
| 0.1.0-alpha.8 | 253 | 10/2/2026 |
| 0.1.0-alpha.7 | 57 | 10/2/2026 |
| 0.1.0-alpha.6 | 48 | 10/1/2026 |
| 0.1.0-alpha.5 | 62 | 10/1/2026 |
| 0.1.0-alpha.4 | 54 | 10/1/2026 |
| 0.1.0-alpha.3 | 56 | 9/30/2026 |
| 0.1.0-alpha.2 | 56 | 9/30/2026 |
| 0.1.0-alpha.1 | 58 | 9/30/2026 |