StyleBro.Analyzers 0.7.0-alpha.1

This is a prerelease version of StyleBro.Analyzers.
dotnet add package StyleBro.Analyzers --version 0.7.0-alpha.1
                    
NuGet\Install-Package StyleBro.Analyzers -Version 0.7.0-alpha.1
                    
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.7.0-alpha.1">
  <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.7.0-alpha.1" />
                    
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.7.0-alpha.1
                    
#r "nuget: StyleBro.Analyzers, 0.7.0-alpha.1"
                    
#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.7.0-alpha.1
                    
#: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.7.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=StyleBro.Analyzers&version=0.7.0-alpha.1&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.

Documentation: bisforboman.github.io/stylebro (the docs/ folder as a searchable site).

New here? Getting started: from install to the first dotnet format run, for a new project or coming from StyleCop.

Deciding whether to switch from StyleCop? StyleBro vs StyleCop: coverage, speed, correctness and migration, with measured numbers.

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. One exception, on purpose: a rename that would break code only the fix can see (a name read by reflection, used in generated code) is left with its warning, and stylebro-migrate format lists each with its 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 stylebro-migrate init turns it on in .editorconfig.
  • Configurable through .editorconfig, with a recommended preset shipped as a low-priority global config.

Rules

128 rules, each with a code fix. The full list, with what each one replaces and whether it's on by default: docs/rules.

Area Rules For example
Ordering, spacing and comments 7 member order, accessor order, comment and directive spacing
Readability 51 string.Empty, else if, list and query layout, lambdas, tuples, null checks
Naming 14 casing of fields, parameters and types, I/T prefixes, Async suffix
Maintainability 10 access modifiers, parentheses, trailing commas
Layout 27 blank lines, braces, single-line blocks, line breaks when wrapping
Documentation 19 <inheritdoc/>, periods, summary wording, file headers

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.7.0-alpha.1" PrivateAssets="all" />

Then, once per repository, turn on the built-in .NET rules StyleBro relies on (IDE0055 formatting, IDE0036 modifier order, ...). Their severities have to be in .editorconfig: dotnet format ignores severities from a package's preset.

dotnet tool install --global StyleBro.Migrate --prerelease
stylebro-migrate init --write      # adds a block to .editorconfig
stylebro-migrate format            # whitespace + StyleBro's rules + the built-in rules init turns on
dotnet format analyzers --diagnostics BRO1001

The preset (StyleBro's rule severities and the formatting options) comes with the package. To opt out and configure everything yourself: <StyleBroPreset>none</StyleBroPreset>. Coming from StyleCop? Use stylebro-migrate --write instead of init (below). Checking it in CI: docs/ci.md.

stylebro-migrate format is dotnet format (same options) limited to StyleBro's and those built-in rules: plain dotnet format also applies every other analyzer's and the compiler's fixes, which can break the build. With several target frameworks it runs once per framework, where plain dotnet format crashes on the SDK's formatting fix (details in docs/ci.md).

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.

Baseline: fail only on new violations

In a codebase with many existing violations, stylebro-migrate baseline records them in stylebro.baseline. The build, the IDE and dotnet format then ignore those (every StyleBro rule and the SDK rules stylebro-migrate init turns on), so only new code has to follow the rules; a violation counts as new once its line is edited. See docs/baseline.md.

Versions and security

What the version numbers mean and when 1.0 ships: docs/versioning.md. What changed: CHANGELOG.md (GitHub Releases). Report vulnerabilities privately: SECURITY.md.

Contributing

Repository layout, build and test commands, and the design rules every rule follows: CONTRIBUTING.md.

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 570 10/13/2026
0.6.0-alpha.1 73 10/12/2026
0.5.0-alpha.1 3,408 10/10/2026
0.4.0-alpha.1 77 10/10/2026
0.3.0-alpha.1 75 10/9/2026
0.2.0-alpha.1 116 10/6/2026
0.1.0-alpha.8 247 10/2/2026
0.1.0-alpha.7 51 10/2/2026
0.1.0-alpha.6 43 10/1/2026
0.1.0-alpha.5 55 10/1/2026
0.1.0-alpha.4 48 10/1/2026
0.1.0-alpha.3 53 9/30/2026
0.1.0-alpha.2 52 9/30/2026
0.1.0-alpha.1 56 9/30/2026