StyleBro.Analyzers 0.1.0-alpha.2

This is a prerelease version of StyleBro.Analyzers.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package StyleBro.Analyzers --version 0.1.0-alpha.2
                    
NuGet\Install-Package StyleBro.Analyzers -Version 0.1.0-alpha.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StyleBro.Analyzers" Version="0.1.0-alpha.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StyleBro.Analyzers" Version="0.1.0-alpha.2" />
                    
Directory.Packages.props
<PackageReference Include="StyleBro.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StyleBro.Analyzers --version 0.1.0-alpha.2
                    
#r "nuget: StyleBro.Analyzers, 0.1.0-alpha.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StyleBro.Analyzers@0.1.0-alpha.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StyleBro.Analyzers&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=StyleBro.Analyzers&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Tool

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 BRO prefix.

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 second dotnet format --verify-no-changes run.
  • Don't duplicate the SDK. If a built-in IDE rule 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
BRO1401 Use a trailing comma in multi-line initializers SA1413 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

How every StyleCop rule maps to StyleBro or the SDK: docs/stylecop-mapping.md.

Usage

<PackageReference Include="StyleBro.Analyzers" Version="0.1.0-alpha.1" 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>.

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
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

  1. BRO1600-series documentation: generate XML doc stubs, <inheritdoc/> on overrides and interface implementations, keep <param> in sync with parameters
  2. StyleCop migration tool: read stylecop.json + rulesets and write equivalent .editorconfig
  3. Layout rules the SDK only has as experimental (blank lines, IDE2000 series)
  4. Baseline support: fail only on new violations in legacy codebases
There are no supported framework assets in this package.

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.7.0-alpha.1 1,022 10/13/2026
0.6.0-alpha.1 78 10/12/2026
0.5.0-alpha.1 3,779 10/10/2026
0.4.0-alpha.1 80 10/10/2026
0.3.0-alpha.1 80 10/9/2026
0.2.0-alpha.1 121 10/6/2026
0.1.0-alpha.8 251 10/2/2026
0.1.0-alpha.7 53 10/2/2026
0.1.0-alpha.6 45 10/1/2026
0.1.0-alpha.5 59 10/1/2026
0.1.0-alpha.4 50 10/1/2026
0.1.0-alpha.3 53 9/30/2026
0.1.0-alpha.2 53 9/30/2026
0.1.0-alpha.1 56 9/30/2026