DotCov.Tool
4.3.0
See the version list below for details.
dotnet tool install --global DotCov.Tool --version 4.3.0
dotnet new tool-manifest
dotnet tool install --local DotCov.Tool --version 4.3.0
#tool dotnet:?package=DotCov.Tool&version=4.3.0
nuke :add-package DotCov.Tool --version 4.3.0
DotCov.Tool
dotcov gates any Cobertura report: it tells you, your CI, or your coding agent whether coverage
passes, and exactly which lines and branches to test next.
dotnet tool install -g DotCov.Tool
Quick start
dotcov test --min-line 90 --min-branch 80 # .NET: run the tests, then gate them
dotcov check TestResults/ --min-line 90 --min-branch 80 # any Cobertura report
FAIL: line 81.8% (min 90%), branch 50.0% (min 80%) - line and branch coverage below threshold
files below line or branch threshold:
src/Orders.cs 77.7% lines 33.3% branches
uncovered 14-15 · branches 12 (1/2), 18 (1/4)
The verdict is the first stderr line and matches the exit code. Below it is every file under a threshold, worst first, with the lines no test runs and the branches only partly taken.
For agents
- Streams. Stdout carries only data: the table, markdown, or JSON. The verdict of
check,testandcrapis always the first stderr line; warnings, excluded files and merged reports follow it. - JSON.
--format jsonprints one document that opens with"schemaVersion": 1,"command","inputs"and"warnings".check,testandcrapaddgate:outcome,exitCode,reason(the verdict line), the thresholds, and forcheck/testtheoffenders, each withpath,lineRate,branchRate,uncovered("14-15,21") andpartialBranches. - Size.
--top Ncaps the offenders (default 20) or the files ofreport; uncovered lines are ranges.--no-colororNO_COLOR=1removes ANSI. - Help.
dotcov <command> --helpprints that command's usage, options and exit codes. A mistyped option answers with the closest valid one and the full option list, exit2. dotcov testprintsreports: TestResults/<run>on stderr after the verdict. With--format jsonormdit writes thedotnet testlog toTestResults/<run>/dotnet-test.logand shows it on stderr only when the run fails.
Commands
dotcov test [<project>] --min-line 80 [-- <dotnet test arguments>]
dotcov check TestResults/ --min-line 80 --min-branch 60 --format json
dotcov check coverage/cobertura-coverage.xml --min-line 90 # Vitest, c8, Jest, coverage.py
dotcov report TestResults/ --top 10 # the ten worst files
dotcov crap TestResults/ --max-crap 30 # per-method risk gate
dotcov diff before.xml after.xml --format md
dotcov snapshot TestResults/ --commit SHA --branch main --project MyApp
check and test need --min-line, --min-branch, or both (0 to 100); a dimension left out is
not checked, and 0 disables one. A path is a file or a directory; a directory is searched for
**/*cobertura*.xml and every match is merged. Name other files with --pattern
(--pattern "**/coverage.xml" for gcovr and coverage.py). A directory without a match gets a
warning naming the .xml files it holds.
dotcov test passes the coverage options of the runner dotnet test uses here
(DOTNET_TEST_RUNNER, else test.runner in global.json, else VSTest). Microsoft.Testing.Platform
projects need Microsoft.Testing.Extensions.CodeCoverage (TUnit includes it); VSTest projects get
the collector from Microsoft.NET.Test.Sdk.
Exit codes
| Code | Verdict | Meaning |
|---|---|---|
| 0 | PASS |
Thresholds met; report, diff, snapshot: the command succeeded |
| 1 | FAIL |
Below a threshold |
| 2 | error: |
Usage: unknown command or option, invalid value, missing or extra argument, no threshold, a --source-root no report declares |
| 3 | NODATA |
Nothing measured, a dimension missing, an unscored CRAP method, a file whose <source> root is unresolved |
| 4 | DISABLED |
Every threshold is 0, or --max-crap is infinite |
| 5 | error: |
A path, report, upload or badge failed; a non-passing gate keeps its own code |
| 6 | error: |
dotcov test: the test run failed, coverage was not evaluated |
crap
crap scores every method comp² · (1 − cov)³ + comp, worst first, with each method's
file:line. A fully covered method scores its complexity, so a high score on covered code means
split it, not test it. crap is for .NET: Coverlet embeds complexity in its report, and for
other .NET emitters --metrics from dotnet msbuild /t:Metrics
(Microsoft.CodeAnalysis.Metrics)
supplies it. Istanbul (Vitest, c8, Jest) and coverage.py write none; gate their reports with check.
Every method must be scored: one without complexity or lines makes the gate NODATA, and so
does a metrics member no covered method matches.
Options
| Option | Effect |
|---|---|
--min-line <n>, --min-branch <n> |
check, test: thresholds from 0 to 100, no default |
--format table\|json\|md |
Output format; md is GitHub-flavored markdown |
--top <n> |
Show the N worst files (report) or methods (crap), or cap the offenders (check, test, default 20) |
--exclude-generated |
Skip .g.cs, .designer.cs, /obj/, /bin/, /Migrations/, GlobalUsings.cs, Program.cs |
--exclude-test-code |
Skip test projects and fixtures: *.Tests/, TestSupport/, TestFixtures/ |
--exclude-external |
Skip code built elsewhere: SourceLink paths (/_/...) of dependencies the coverage tool instrumented; otherwise a warning names them |
--keep <subs> |
Comma-separated substrings exempt from the exclusions (diff applies them to both reports) |
--probe-sources |
Several <source> roots: resolve each file against the root that holds it on this disk |
--source-root <root> |
Several <source> roots: resolve against this declared root |
--pattern <glob> |
Report file name to search for; default **/*cobertura*.xml |
--max-chars <n> |
Per-file XML character cap; default 50000000, 0 = none |
--github-summary |
Append markdown to $GITHUB_STEP_SUMMARY, on pass and fail |
--upload <url> |
POST the JSON document |
--badge-dir <dir> |
check, test: write coverage-badge.svg and coverage-badge.json for every outcome |
--no-color |
No ANSI colour; accepted by every command that reads a report; test passes NO_COLOR=1 to dotnet test |
A command rejects an option it does not take, --name=value, and a second path; it never
ignores one. An active exclusion is listed on stderr and in the JSON as excluded and
exclusionRules. Percentages read 62.0% on every host.
Also in this family
DotCov — the parser and gates as a library · DotCov.Fallout — coverage targets for Fallout builds
Documentation · Issues · MIT
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.7.0 | 0 | 10/15/2026 |
| 4.6.0 | 0 | 10/15/2026 |
| 4.5.0 | 3 | 10/15/2026 |
| 4.4.0 | 8 | 10/15/2026 |
| 4.3.2 | 25 | 10/15/2026 |
| 4.3.1 | 41 | 10/15/2026 |
| 4.3.0 | 63 | 10/14/2026 |
| 4.2.0 | 59 | 10/14/2026 |
| 4.1.0 | 68 | 10/14/2026 |
| 4.0.0 | 66 | 10/14/2026 |
| 3.0.1 | 65 | 10/14/2026 |
| 3.0.0 | 80 | 10/13/2026 |
| 2.0.0 | 72 | 10/13/2026 |
| 1.7.1 | 89 | 10/11/2026 |
| 1.7.0 | 138 | 10/11/2026 |
| 1.6.1 | 76 | 10/11/2026 |
| 1.6.0 | 83 | 10/11/2026 |
| 1.5.0 | 78 | 10/11/2026 |
| 1.4.0 | 87 | 10/11/2026 |
| 1.3.0 | 104 | 9/29/2026 |
DotCov 4.3.0 makes the TypeScript path and the crap scope explicit.
README: Vitest (accurate source branches) and c8 (zero-config wrapper around node --test) produce Cobertura for check; Jest still works.
crap is for .NET: a report in which no method has complexity (Istanbul: Vitest, c8, Jest; coverage.py) now gets a NODATA reason that says so instead of pointing at dotnet msbuild.
Full notes: https://github.com/ANcpLua/dotcov/blob/main/docs/releases/4.3.0.md