Mithril.Analyzers 0.1.1

dotnet add package Mithril.Analyzers --version 0.1.1
                    
NuGet\Install-Package Mithril.Analyzers -Version 0.1.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="Mithril.Analyzers" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mithril.Analyzers" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Mithril.Analyzers" />
                    
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 Mithril.Analyzers --version 0.1.1
                    
#r "nuget: Mithril.Analyzers, 0.1.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 Mithril.Analyzers@0.1.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=Mithril.Analyzers&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Mithril.Analyzers&version=0.1.1
                    
Install as a Cake Tool

Mithril.Analyzers

Mithril.Analyzers is an MIT-licensed Roslyn analyzer package focused on backend maintainability guardrails and repository-informed architecture checks.

The first delivery wave stays intentionally small and conservative:

  • V1 covers BGA001 to BGA005
  • configuration lives in .editorconfig
  • generated code is ignored by default
  • the package is packed as analyzer-only content so consumers get no runtime dependency

Package Status

  • Status: bootstrap in progress
  • Current scope: V1 maintainability parity for oversized files, methods, accessors, async cancellation exposure, and ContainsKey double lookups
  • Deferred to later phases: BGA100+ repository-informed architecture diagnostics

Rule Table

ID Title Default severity Primary config Docs
BGA001 File Too Long warning mithril_analyzers.max_file_lines BGA001
BGA002 Method Too Long warning mithril_analyzers.max_method_lines BGA002
BGA003 Accessor Too Long warning mithril_analyzers.max_accessor_lines BGA003
BGA004 Async Method Should Expose Cancellation suggestion mithril_analyzers.allow_missing_cancellation_for_tests BGA004
BGA005 Prefer TryGetValue suggestion n/a BGA005

Install

Use the package as a build-only analyzer dependency:

<ItemGroup>
  <PackageReference Include="Mithril.Analyzers" Version="0.1.0" PrivateAssets="all" />
</ItemGroup>

.editorconfig Example

[*.cs]
dotnet_diagnostic.BGA001.severity = warning
dotnet_diagnostic.BGA002.severity = warning
dotnet_diagnostic.BGA003.severity = warning
dotnet_diagnostic.BGA004.severity = suggestion
dotnet_diagnostic.BGA005.severity = suggestion

mithril_analyzers.max_accessor_lines = 60
mithril_analyzers.allow_missing_cancellation_for_tests = true

[src/**/*.cs]
mithril_analyzers.max_file_lines = 800
mithril_analyzers.max_method_lines = 100

[tests/**/*.cs]
mithril_analyzers.max_file_lines = 1000
mithril_analyzers.max_method_lines = 140

[tools/**/*.cs]
mithril_analyzers.max_file_lines = 800
mithril_analyzers.max_method_lines = 100

Suppression Examples

Use the normal Roslyn suppression surfaces when a diagnostic is intentionally not actionable:

#pragma warning disable BGA004
public Task<string> ExecuteAsync()
{
    return Task.FromResult("intentionally non-cancellable");
}
#pragma warning restore BGA004
[System.Diagnostics.CodeAnalysis.SuppressMessage(
    "Maintainability",
    "BGA002:Method Too Long",
    Justification = "Legacy orchestration remains until the module split ships.")]

Repository Layout

Development

dotnet restore Mithril.Analyzers.sln
dotnet build Mithril.Analyzers.sln --no-restore
dotnet test Mithril.Analyzers.sln --no-build

Releasing

Push a semver tag like v0.1.0 for a commit reachable from main after updating src/Mithril.Analyzers/Mithril.Analyzers.csproj and configuring the NUGET_API_KEY GitHub Actions secret. The Release Package GitHub Action validates the tag/version pair, builds and tests the solution, publishes the package to NuGet.org, and attaches the .nupkg to the matching GitHub Release.

See docs/releasing.md for the full checklist.

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.1.1 407 3/30/2026