Skip to content

StyleBro

Roslyn analyzers and code fixes that keep C# code tidy, built so that dotnet format fixes everything they report: every rule has a fix, Fix All works, and one run leaves nothing behind. Most StyleCop rules have a StyleBro or SDK replacement, and bro migrate moves a StyleCop project over without reformatting it.

Every warning comes with its fix. Rule IDs use the BRO prefix.

  • 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. One exception, on purpose: a rename that would break code only the fix can see (a name read by reflection, used in generated code) keeps its warning, and bro format lists it with the reason (Findings kept on purpose).
  • Don't duplicate the SDK. If a built-in IDE rule already covers a StyleCop rule, StyleBro uses that rule instead of shipping a copy: the preset sets its options and bro init turns it on in .editorconfig.
  • Configurable through .editorconfig, with a recommended preset shipped in the package.

Install

<PackageReference Include="StyleBro.Analyzers" Version="0.8.0-alpha.1" PrivateAssets="all" />
dotnet tool install --global StyleBro.Tool --prerelease
bro init --write      # turns on the built-in rules StyleBro relies on, in .editorconfig
bro format            # whitespace + StyleBro's rules + those built-in rules

Coming from StyleCop? Run bro migrate --write instead of init: see Migrating from StyleCop.

Where next