Three data sources. One dashboard. Measurable improvement.
MetricsReporter is a .NET 8 CLI tool that aggregates code coverage, complexity, coupling, and analyzer violations from three independent sources into one interactive dashboard — then lets you (or your AI agent) fix everything via a structured refactoring loop.
coverage.xml + metrics.xml + violations.sarif → one interactive HTML
(OpenCover) (Roslyn) (Analyzers) + unified JSON
Production-Ready Example
MetricsReporter is now also demonstrated on baidakovil/eShop, a production-ready reference application forked from dotnet/eShop. That repository shows the full end-to-end setup on a non-trivial external solution: Roslyn metrics, SARIF diagnostics, OpenCover coverage, ReportGenerator output, AI-assisted refactoring, and a published HTML dashboard. Explore the example repository or open the interactive demo for eShop.
Dashboard Output
Production-ready example on Ubuntu in GitHub Codespaces, viewed from macOS
▶ Open Production-Ready eShop Demo
MetricsReporter is OS-independent: Dashboard Output on Windows ARM64
▶ Open Live Interactive Demo
Your C# project has growing tech debt, but:
- Coverage, metrics, and violations live in three separate files — OpenCover XML, Roslyn XML, and SARIF JSON
- No single view shows coupling, complexity, coverage, and analyzer violations together
- You can't measure whether a refactoring actually helped
- AI agents don't know which method to fix first or whether the fix worked
# Install
dotnet tool install --global MetricsReporter.Tool
# Generate dashboard from your three data sources
metricsreporter generate --opencover coverage.xml --roslyn metrics.xml --sarif analyzers.sarif --output-html report.html
# Query violations from CLI — returns JSON
metricsreporter read --namespace MyApp.Services --metric Coupling
# → [{"kind":"Type","fullyQualifiedName":"MyApp.Services.OrderService","metrics":{"RoslynClassCoupling":{"value":14,"status":"Warning"}}}]
# Verify a fix passes thresholds
metricsreporter test --symbol MyApp.Services.OrderService.Process --metric Complexity
# → {"isOk":true}Open report.html — you'll see the dashboard from the screenshot above.
Next step → Full tutorial: produce your first dashboard · CLI reference · Configuration reference
Interactive HTML Dashboard — Drill down from Solution → Assembly → Namespace → Type → Method. Filter instantly, toggle warning/error awareness, hover for metric details. Self-contained HTML, no server, handles 50k+ symbols. → details
AI-Driven Refactoring — Give any AI agent (Copilot, Cursor, Claude) a namespace and a metric. It reads the violation, edits the code, rebuilds, and verifies — autonomously. Ready-to-use prompt files included. → workflow
Threshold Gates for CI — Define warning/error thresholds per metric per symbol level. CLI exits with 0 (pass) or non-zero (fail) — plug it straight into your pipeline. → details
Baseline & Delta Tracking — Every run saves a baseline. Next run computes deltas automatically, per method — complexity, coverage, violations. → details
Suppression System — Mark intentional exceptions with [SuppressMessage]. They show up in the dashboard with justifications, not as false alarms. → details
ReportGenerator Integration — Link to line-by-line HTML coverage maps. Script hooks trigger full rebuild + coverage recollection as part of the AI verify step. → details
Rich interactive UI — adjustable thresholds, delta tracking, suppressions, tooltips, ReportGenerator deep links, and more
MetricsReporter ships with ready-to-use prompt files for Copilot, Cursor, or any AI agent:
# 1. Agent asks: "what's broken?"
metricsreporter read --namespace MyApp.Services --metric Coupling
# 2. Agent reads the source, edits files, runs `dotnet build`
# 3. Agent verifies the fix:
metricsreporter test --symbol MyApp.Services.OrderProcessor --metric Coupling
# → { "isOk": true } ✅
# 4. Repeat until clean| Prompt file | What the agent does |
|---|---|
refactor-complexity.md |
Reduce cyclomatic complexity below thresholds |
refactor-coupling.md |
Reduce class coupling with DI, interfaces, DTOs |
refactor-coverage.md |
Write tests until branch coverage passes |
refactor-sarif.md |
Fix CA/IDE analyzer violations |
- Cross-format symbol resolution — cross-links symbols across three unrelated XML/JSON formats by fully-qualified name, handling compiler-generated state machines and namespace mismatches (details)
- Clean architecture — command handlers, dependency injection, interface segregation, NUnit + NSubstitute test suite
- Zero-dependency HTML — renders 50k+ symbols with vanilla JS, no frameworks, no CDN — one self-contained file
- Three-layer configuration — CLI flags → env vars → JSON config → defaults, with JSON schema validation (reference)
- Structured CLI — four commands (
generate,read,readsarif,test) with JSON output to stdout — designed for both human and machine consumption
flowchart LR
cov["OpenCover XML"]
ros["Roslyn XML"]
sar["SARIF files"]
subgraph gen["metricsreporter generate"]
par["Parsers"] --> agg["Aggregator"] --> ren["Renderer"]
end
cov --> par
ros --> par
sar --> par
ren --> json["report.json"]
ren --> html["report.html"]
json --> read["read / test / readsarif"]
read --> ai["AI agent loop"]
| Layer | Key classes | Responsibility |
|---|---|---|
| Parsers | OpenCoverMetricsParser, RoslynMetricsParser, SarifMetricsParser |
Parse each format into a unified symbol model |
| Aggregator | MetricsAggregationService |
Merge into Solution→Assembly→Namespace→Type→Member tree, apply thresholds, compute deltas |
| Renderer | NodeHierarchyRenderer, MetricValueRenderer |
Serialize queryable JSON + self-contained HTML |
| CLI | CommandHandler<TOptions> |
Four commands backed by DI-composed pipeline |
- Solo developers tracking tech debt across coverage, complexity, and violations in one place
- Teams enforcing quality gates in CI with threshold-based exit codes
- AI agent operators running autonomous refactoring loops — no API keys, no servers, just CLI
| Tutorials | Get your first dashboard running |
| How-To Guides | Config files, scripts, shipping updates |
| Reference | CLI commands, config schema, report format, suppressions |
| Explanation | Architecture, coverage pipeline, namespace inference |
| Feature Deep Dive | Dashboard, AI integration, suppressions, reconciliation engine |
git clone https://github.com/baidakovil/metricsreporter.git
cd metricsreporter
dotnet restore && dotnet build && dotnet testThe project follows SOLID principles, uses DI throughout, and maintains a comprehensive NUnit test suite. See CONTRIBUTING.md for code style, branch workflow, and PR guidelines.