StyleSharp.Analyzers
3.13.2
See the version list below for details.
dotnet add package StyleSharp.Analyzers --version 3.13.2
NuGet\Install-Package StyleSharp.Analyzers -Version 3.13.2
<PackageReference Include="StyleSharp.Analyzers" Version="3.13.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="StyleSharp.Analyzers" Version="3.13.2" />
<PackageReference Include="StyleSharp.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add StyleSharp.Analyzers --version 3.13.2
#r "nuget: StyleSharp.Analyzers, 3.13.2"
#:package StyleSharp.Analyzers@3.13.2
#addin nuget:?package=StyleSharp.Analyzers&version=3.13.2
#tool nuget:?package=StyleSharp.Analyzers&version=3.13.2
<br> <a href="https://github.com/glennawatson/RoslynCommonAnalyzers"> <img width="160" height="160" src="https://raw.githubusercontent.com/glennawatson/RoslynCommonAnalyzers/main/icons/icon.png" alt="StyleSharp.Analyzers"> </a> <br>
StyleSharp.Analyzers
StyleSharp.Analyzers is a performance-focused Roslyn analyzer and code-fix package for .NET codebases. What started as the unique-line list family has grown into a broader ruleset covering spacing, readability, ordering, layout, naming, maintainability, documentation, extension blocks, records, concurrency, modernization, collection expressions, and modern C# syntax.
The package is analyzer-only, targets netstandard2.0, ships as a DevelopmentDependency, and packs analyzer/code-fix assemblies for multiple Roslyn slots under one NuGet package.
Installation
dotnet add package StyleSharp.Analyzers
The package adds no runtime assemblies to your output and is not transitive to consumers of your library.
Documentation
- Full rule catalog:
docs/README.md - Configuration:
docs/CONFIGURATION.md - Performance guidance:
docs/PERFORMANCE.md - Ready-to-use preset:
recommended.editorconfig
The rule catalog is intentionally split out of this README so the GitHub landing page stays readable while the detailed rule index can grow with the project.
Rule Categories
Spacingfor token and whitespace conventionsReadabilityfor query layout, unique-line lists, tuple/null/style conventions, expression simplification, redundant-code removal, and similar readability rulesOrderingfor using ordering, modifier ordering, accessor ordering, and member orderingLayoutfor brace placement, blank-line rules, and block consistencyNamingfor .NET naming conventions, async-method suffixes, and override parameter namesMaintainabilityfor access modifiers, precedence, auto-properties, nameof, trailing commas, redundant modifiers, exception handling, type design, and related rulesDocumentationfor XML docs, file headers, and documentation quality rulesExtensionsfor C# 14 extension-block conventionsRecordsfor record and record-struct conventionsConcurrencyfor lock usage rulesModernizationfor runtime throw-helper adoption and pattern-matching formsCollectionExpressionsfor collection-expression usageModernSyntaxfor new language features such as the C# 14fieldkeyword
Unless a rule is marked opt-in, it is enabled by default at Warning severity.
Configuration
StyleSharp is configured entirely through .editorconfig. Severity uses the standard dotnet_diagnostic.<RuleId>.severity keys, and rule options use the compiler-provided analyzer config system.
[*.cs]
dotnet_diagnostic.SST1309.severity = warning
stylesharp.tuple_element_naming = pascal_case
stylesharp.union_member_naming = pascal_case
See docs/CONFIGURATION.md for the full option list and the recommended configuration approach.
Repository Layout
| Project | Purpose |
|---|---|
src/StyleSharp.Analyzers |
analyzer implementations |
src/StyleSharp.Analyzers.CodeFixes |
code-fix implementations |
src/StyleSharp.Analyzers.Package |
NuGet packaging |
src/tests/StyleSharp.Analyzers.Tests |
TUnit + Microsoft.CodeAnalysis.Testing test suite |
src/benchmarks/StyleSharp.Analyzers.Benchmarks |
BenchmarkDotNet perf harness |
Building And Testing
Run these commands from src/:
dotnet build StyleSharp.Analyzers.slnx -c Release
dotnet test --project tests/StyleSharp.Analyzers.Tests/StyleSharp.Analyzers.Tests.csproj -c Release
To pack every Roslyn slot into the published NuGet package:
dotnet pack StyleSharp.Analyzers.Package/StyleSharp.Analyzers.Packages.csproj -c Release
Contributing
Issues and pull requests are welcome.
When adding a rule, update all of the following:
- analyzer implementation
- code-fix implementation if the rule is fixable
- tests
docs/rules/SST####.mdsrc/StyleSharp.Analyzers/AnalyzerReleases.Unshipped.mdrecommended.editorconfigif the rule should appear in the preset
Performance is a first-class requirement. Read docs/PERFORMANCE.md before changing analyzer hot paths, and benchmark changes rather than guessing.
License
MIT — see LICENSE.
Acknowledgements
The analyzers and code fixes here are written from scratch. No source code was copied from the projects below. License references are included in LICENSE where applicable.
- StyleCop.Analyzers, licensed under the MIT License, inspired the original shape of the project. Thanks to Sam Harwell and the StyleCop.Analyzers contributors.
- Roslynator, licensed under the Apache License 2.0, inspired some diagnostic design choices. Thanks to Josef Pihrt and the Roslynator contributors.
- The .NET SDK analyzer guidance and dotnet/roslyn, licensed under the MIT License, inspired parts of the style-rule coverage. Thanks to the .NET and Roslyn teams.
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 |
|---|---|---|
| 3.16.7 | 50 | 7/6/2026 |
| 3.16.6 | 44 | 7/6/2026 |
| 3.16.5 | 47 | 7/6/2026 |
| 3.16.4 | 38 | 7/6/2026 |
| 3.16.3 | 53 | 7/6/2026 |
| 3.16.2 | 78 | 7/5/2026 |
| 3.16.1 | 42 | 7/5/2026 |
| 3.16.0 | 90 | 7/5/2026 |
| 3.15.2 | 44 | 7/5/2026 |
| 3.15.1 | 45 | 7/5/2026 |
| 3.15.0 | 49 | 7/5/2026 |
| 3.14.0 | 119 | 7/4/2026 |
| 3.13.4 | 1,288 | 6/23/2026 |
| 3.13.3 | 146 | 6/23/2026 |
| 3.13.2 | 132 | 6/23/2026 |
| 3.13.1 | 117 | 6/23/2026 |
| 3.13.0 | 144 | 6/22/2026 |
| 3.12.14 | 347 | 6/22/2026 |
| 3.12.13 | 116 | 6/22/2026 |
| 3.12.12 | 114 | 6/22/2026 |