Meridian.Analyzer
0.2.6
See the version list below for details.
dotnet add package Meridian.Analyzer --version 0.2.6
NuGet\Install-Package Meridian.Analyzer -Version 0.2.6
<PackageReference Include="Meridian.Analyzer" Version="0.2.6" />
<PackageVersion Include="Meridian.Analyzer" Version="0.2.6" />
<PackageReference Include="Meridian.Analyzer" />
paket add Meridian.Analyzer --version 0.2.6
#r "nuget: Meridian.Analyzer, 0.2.6"
#:package Meridian.Analyzer@0.2.6
#addin nuget:?package=Meridian.Analyzer&version=0.2.6
#tool nuget:?package=Meridian.Analyzer&version=0.2.6
Meridian.Analyzer
Meridian.Analyzer is a Roslyn analyzer package for ASP.NET Core codebases with opinionated readability, architecture, security, reliability, and performance rules.
Quick Start
Install the published analyzer package into a project:
dotnet add package Meridian.Analyzer
Or add an explicit package reference:
<ItemGroup>
<PackageReference Include="Meridian.Analyzer" Version="0.2.*" PrivateAssets="all" />
</ItemGroup>
Repository Layout
src/Meridian.Analyzer/: analyzer project, rule implementations, helpers, and Roslyn release tracking filestests/Meridian.Analyzer.Tests/: analyzer behavior testsdocs/: maintainer guidance, examples, and per-rule documentationLICENSE: MIT license for the repository and published package metadata
Documentation
- Usage examples: docs/usage-example.md
- Maintainer guide: docs/guide.md
- Per-rule documentation: docs/rules/
Package Facts
- Analyzer project:
src/Meridian.Analyzer/Meridian.Analyzer.csproj - Test project:
tests/Meridian.Analyzer.Tests/Meridian.Analyzer.Tests.csproj - Diagnostic prefix:
MER - Category namespaces:
Meridian.Readability,Meridian.Security,Meridian.Architecture,Meridian.Reliability,Meridian.Performance - Packaging status: published on
nuget.org
Local Checks
- Local test run:
dotnet test tests/Meridian.Analyzer.Tests/Meridian.Analyzer.Tests.csproj -c Release - Local package smoke check:
dotnet pack src/Meridian.Analyzer/Meridian.Analyzer.csproj -c Release -o artifacts
Run these from this repo before publishing or sending a change for review.
Configure Severity
Configure analyzer severities in your consuming project's .editorconfig:
[*.cs]
dotnet_diagnostic.MER0001.severity = warning
dotnet_diagnostic.MER0002.severity = warning
You can enable as many or as few rules as you want. Each rule doc explains what it reports and how to refactor away from it.
Notes
nuget.orgis a public feed.- Some rules encode opinionated architectural conventions. Review the rule docs before enabling large sets as build warnings in an existing codebase.
Current Rules
| Rule | Diagnostic ID | Category | Preferred refactor |
|---|---|---|---|
| Ternary in initializer payload branches | MER0001 |
Readability | Stage the payload branch in a named local or helper before building the initializer |
| Broad nested try/catch fallback flow | MER0002 |
Readability | Extract the inner fallback branch into a helper or flatten the exception-handling flow |
| Unsafe output-cache usage | MER0003 |
Security | Remove [OutputCache] or replace it with no-store caching unless you have a clearly safe cache policy |
| Missing explicit controller policy | MER0004 |
Security | Declare class-level or action-level policies on admin and high-risk controllers |
| Admin controller shape mismatch | MER0005 |
Security | Align admin controllers on Admin*Controller, api/admin, and AdminControllerBase |
| Controller service location | MER0006 |
Architecture | Use constructor injection or [FromServices] instead of action-body service location |
| Raw configuration reads | MER0007 |
Reliability | Move raw reads to typed options, startup guards, or provider adapters |
| Startup bypass flag containment | MER0008 |
Security | Move MERIDIAN_SKIP_* reads behind StartupGuards or typed startup-skip options |
| Missing controller cancellation token | MER0009 |
Reliability | Add CancellationToken to async actions and avoid CancellationToken.None in request code |
| Direct time and delay APIs | MER0010 |
Reliability | Use a clock abstraction or TimeProvider for runtime time or delay work |
| Static mutable runtime state | MER0011 |
Reliability | Move static mutable state from controllers or handlers into injectable bounded services |
| Health-check registration parity | MER0012 |
Reliability | Register every source Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck through health-check registration |
| Layering violations | MER0013 |
Architecture | Move dependencies back to the intended layer |
| Model ownership drift | MER0014 |
Architecture | Keep DTOs feature-local and entities in dedicated entity folders |
| String helper usage | MER0015 |
Readability | Use shared string helpers in in-memory code |
| Ad hoc JSON options | MER0016 |
Architecture | Move ad hoc JSON options into shared profiles or a named factory |
| Unbounded EF materialisation | MER0017 |
Performance | Add obvious Where, Take, or Skip bounds before async materialisation |
| Raw SQL outside persistence code | MER0018 |
Security | Keep SQL in persistence code and prefer interpolated APIs over raw APIs |
| Direct ProblemDetails construction | MER0019 |
Reliability | Use shared ProblemDetails helpers from controller actions |
| Controller data access | MER0020 |
Architecture | Delegate repository, DbContext, and EF work to services or facades |
| Non-Serilog runtime logging | MER0021 |
Reliability | Use Serilog in runtime code and keep framework logging at the edges |
| Direct Redis keyspace scans | MER0022 |
Performance | Route IServer.Keys scans through a dedicated bounded helper |
| Detached runtime tasks | MER0023 |
Reliability | Give background work an explicit lifetime, cancellation path, and observable failure path |
| Queryable string-extension predicates | MER0024 |
Reliability | Replace StringExtensions.IsNullOr* inside queryable or expression-returning methods with translatable query guards |
| Empty is-pattern braces | MER0025 |
Readability | Replace empty property-pattern braces with shared nullable helpers or explicit null checks when behavior matches |
Rule-Addition Checklist
Before landing MER0002+ or any later rule, update these surfaces in the same change:
- Analyzer implementation under
src/Meridian.Analyzer/ - Positive and negative tests under
tests/Meridian.Analyzer.Tests/ - Rule documentation under
docs/rules/ - The rule index in this
README.md docs/guide.mdordocs/usage-example.mdwhen the docs or maintainer flow changed
| 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
- 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.
See CHANGELOG.md and GitHub releases for package and rule updates.