IIMMPACT.CodeQuality
0.1.0
See the version list below for details.
dotnet add package IIMMPACT.CodeQuality --version 0.1.0
NuGet\Install-Package IIMMPACT.CodeQuality -Version 0.1.0
<PackageReference Include="IIMMPACT.CodeQuality" Version="0.1.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="IIMMPACT.CodeQuality" Version="0.1.0" />
<PackageReference Include="IIMMPACT.CodeQuality"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add IIMMPACT.CodeQuality --version 0.1.0
#r "nuget: IIMMPACT.CodeQuality, 0.1.0"
#:package IIMMPACT.CodeQuality@0.1.0
#addin nuget:?package=IIMMPACT.CodeQuality&version=0.1.0
#tool nuget:?package=IIMMPACT.CodeQuality&version=0.1.0
iimmpact-dotnet-quality
IIMMPACT's shared C# code-quality rules: analyzer configuration shipped as a NuGet package, plus a dotnet tool that gates new violations on a per-file baseline.
Packages
| Package | What it is |
|---|---|
IIMMPACT.CodeQuality |
Analyzer config package. References SonarAnalyzer.CSharp and Microsoft.CodeAnalysis.BannedApiAnalyzers and injects a .globalconfig, SonarLint.xml, CodeMetricsConfig.txt, and BannedSymbols.IIMMPACT.txt into the build. DevelopmentDependency, so it never flows to downstream consumers of your package. |
IIMMPACT.CodeQuality.Tool |
dotnet tool iimmpact-quality with check and baseline commands. Builds the solution with SARIF logging enabled, collects diagnostics for the managed rules, and compares them against code-quality-baseline.json. |
Managed rules
The package turns these rules on as warnings:
| Rule | Threshold | Source of the limit |
|---|---|---|
| CA1502 cyclomatic complexity | 25 | CodeMetricsConfig.txt |
| CA1506 class/method coupling | 60 (type), 40 (method) | CodeMetricsConfig.txt |
| S134 nesting depth | 4 | SonarLint.xml |
| S138 method lines | 60 | SonarLint.xml |
| S104 file lines | 400 | SonarLint.xml |
| S4462 blocking async calls | — | globalconfig |
| CA1849, CA2016 async correctness | — | globalconfig |
| CA2254 logging template | — | globalconfig |
| RS0030 banned APIs | DateTime.Now, DateTimeOffset.Now, System.Console, new HttpClient() |
BannedSymbols.IIMMPACT.txt |
| IDE0051, IDE0052, IDE0060 unused code | non-public parameters | globalconfig |
Usage
Reference the package in every project you want checked:
<PackageReference Include="IIMMPACT.CodeQuality" Version="0.1.0" PrivateAssets="all" />
Install the tool once per repo:
dotnet tool install IIMMPACT.CodeQuality.Tool
Record existing debt, then gate:
dotnet iimmpact-quality baseline MyApp.slnx # writes code-quality-baseline.json
dotnet iimmpact-quality check MyApp.slnx # fails on growth or stale entries
check exits non-zero when:
- a file gains diagnostics beyond what the baseline records (growth),
- the baseline records more diagnostics than the build reports (stale), or
- repo config silences a managed rule (
dotnet_diagnostic.<id>.severity = none|silent|suggestionin.editorconfig/.globalconfig, or the rule in<NoWarn>in.props/.targets/.csproj).
How the tool works
iimmpact-quality runs dotnet sln list to find projects, deletes each project's obj/iimmpact-quality directory, rebuilds with -p:IimmpactQualitySarif=true, then parses the SARIF logs that IIMMPACT.CodeQuality.targets wires into ErrorLog. Diagnostics for rules outside the managed list are ignored, so unrelated analyzer noise never fails the gate.
Releasing
Tag v<version> where <version> equals the <Version> in Directory.Build.props. The release workflow verifies the tag, packs both packages, publishes to nuget.org via NuGet/login OIDC, and creates the GitHub release.
License
MIT — IIMMPACT SDN BHD.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.BannedApiAnalyzers (>= 4.14.0)
- SonarAnalyzer.CSharp (>= 10.35.0.4138)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.