StyleSharp.Analyzers 3.13.2

There is a newer version of this package available.
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
                    
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="StyleSharp.Analyzers" Version="3.13.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="StyleSharp.Analyzers" Version="3.13.2" />
                    
Directory.Packages.props
<PackageReference Include="StyleSharp.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 StyleSharp.Analyzers --version 3.13.2
                    
#r "nuget: StyleSharp.Analyzers, 3.13.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 StyleSharp.Analyzers@3.13.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=StyleSharp.Analyzers&version=3.13.2
                    
Install as a Cake Addin
#tool nuget:?package=StyleSharp.Analyzers&version=3.13.2
                    
Install as a Cake Tool

CI Build Coverage Reliability Rating Duplicated Lines (%) Vulnerabilities Security Rating NuGet Downloads GitHub stars License: MIT

<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

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

  • Spacing for token and whitespace conventions
  • Readability for query layout, unique-line lists, tuple/null/style conventions, expression simplification, redundant-code removal, and similar readability rules
  • Ordering for using ordering, modifier ordering, accessor ordering, and member ordering
  • Layout for brace placement, blank-line rules, and block consistency
  • Naming for .NET naming conventions, async-method suffixes, and override parameter names
  • Maintainability for access modifiers, precedence, auto-properties, nameof, trailing commas, redundant modifiers, exception handling, type design, and related rules
  • Documentation for XML docs, file headers, and documentation quality rules
  • Extensions for C# 14 extension-block conventions
  • Records for record and record-struct conventions
  • Concurrency for lock usage rules
  • Modernization for runtime throw-helper adoption and pattern-matching forms
  • CollectionExpressions for collection-expression usage
  • ModernSyntax for new language features such as the C# 14 field keyword

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####.md
  • src/StyleSharp.Analyzers/AnalyzerReleases.Unshipped.md
  • recommended.editorconfig if 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.
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
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
Loading failed