Shimmering.Analyzers
is a NuGet package consisting of Roslyn analyzers, written to promote best practices in .NET and enforce opinionated code styles.
dotnet add package Shimmering.Analyzers
You can add the following PackageReference
item to an ItemGroup
element in your csproj
file:
<PackageReference Include="Shimmering.Analyzers" Version="1.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
After you've installed Shimmering.Analyzers
, you may see additional output in Error List
of your IDE or build output upon your first build, if there is any offending code. If a code fix is available for the rule, you can apply the code fix to improve the code.
If you want to customize the severity of the analyzers, you can use .editorconfig
to do so.
For example, if you don't like the default severity of SHIMMER1000
, you can adjust it like this:
[*.cs]
dotnet_diagnostic.SHIMMER1000.severity = info
Alternatively, if you like all of the rules, you can bulk-configure the severity of all rules in the same category like this:
[*.cs]
dotnet_analyzer_diagnostic.category-ShimmeringUsage.severity = error
dotnet_analyzer_diagnostic.category-ShimmeringStyle.severity = error
This NuGet package was initially inspired by @madelson's internal documentation ("Mike Cop") on .NET best practices that he created during his time at @mastercard. @Bartleby2718 obtained @mastercard's approval to publish an open-source NuGet package enforcing some of those rules through Roslyn analyzers, hoping to share these best practices more widely with the broader .NET community.
Please see https://bartleby2718.github.io/Shimmering.Analyzers/docs/AllRules.
Please see https://bartleby2718.github.io/Shimmering.Analyzers/docs/CONTRIBUTING.