CoverageChecker 0.2.0
See the version list below for details.
dotnet add package CoverageChecker --version 0.2.0
NuGet\Install-Package CoverageChecker -Version 0.2.0
<PackageReference Include="CoverageChecker" Version="0.2.0" />
<PackageVersion Include="CoverageChecker" Version="0.2.0" />
<PackageReference Include="CoverageChecker" />
paket add CoverageChecker --version 0.2.0
#r "nuget: CoverageChecker, 0.2.0"
#:package CoverageChecker@0.2.0
#addin nuget:?package=CoverageChecker&version=0.2.0
#tool nuget:?package=CoverageChecker&version=0.2.0
Coverage Checker
Allows for the checking of code coverage using the provided GitHub action or NuGet package.
GitHub Action
Usage
The code coverage must already have been generated and saved in a file. The action will then parse the coverage file and check the coverage. If desired, the action will fail if the coverage is below the specified threshold.
The action supports the following coverage file formats:
- SonarQube
- Cobertura
- name: Check coverage
uses: Thomas-Shephard/coverage-checker@v0.2.0
with:
format: 'cobertura'
directory: 'coverage'
glob: '**/coverage.cobertura.xml'
line-threshold: 80
branch-threshold: 80
fail-if-below-threshold: true
NuGet Package
Installation
Install the CoverageChecker NuGet package using the .NET CLI:
dotnet add package CoverageChecker
Features
Coverage File Parsing
Multiple coverage file formats are supported, as shown below:
| Format | Class |
|---|---|
| SonarQube | CoverageChecker.Parsers.SonarQubeParser |
| Cobertura | CoverageChecker.Parsers.CoberturaParser |
Coverage Checking
The coverage checker can be used to check the coverage of a project; both line and branch coverage are supported. Coverage can be calculated based on package, file, class, method, line, etc.
Code Example
using CoverageChecker;
using CoverageChecker.Parsers;
using CoverageChecker.Results;
const string directory = @"file-directory";
const string globPattern = "*.xml";
CoberturaParser parser = new(directory, globPattern);
Coverage coverage = parser.LoadCoverage();
foreach (FileCoverage fileCoverage in coverage.Files) {
Console.WriteLine($"Package {fileCoverage.PackageName ?? ""}: File={fileCoverage.Path} Lines={fileCoverage.Lines.Count}");
foreach (IGrouping<string?, LineCoverage> classCoverage in fileCoverage.Lines.GroupBy(line => line.ClassName)) {
Console.WriteLine($"\tClass {classCoverage.Key ?? ""}");
foreach (LineCoverage line in classCoverage.OrderBy(line => line.LineNumber)) {
Console.WriteLine(line.Branches is null
? $"\t\tLine {line.LineNumber}: Covered={(line.IsCovered ? "Yes" : "No")}"
: $"\t\tLine {line.LineNumber}: Covered={(line.IsCovered ? "Yes" : "No")}, Branches=({line.CoveredBranches}/{line.Branches})");
}
}
}
Console.WriteLine($"Total line coverage: {coverage.CalculateOverallCoverage():P1}");
Console.WriteLine($"Total branch coverage: {coverage.CalculateOverallCoverage(CoverageType.Branch):P1}");
Contributions
Contributions are welcome! Read the contributing guide to get started.
License
This project is licensed under the MIT License. See the LICENSE for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. |
-
net8.0
- Microsoft.Extensions.FileSystemGlobbing (>= 8.0.0)
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.9.0 | 124 | 2/15/2026 |
| 0.8.0 | 118 | 1/11/2026 |
| 0.7.0 | 186 | 10/4/2025 |
| 0.6.6 | 172 | 9/28/2025 |
| 0.6.5 | 171 | 11/24/2024 |
| 0.6.4 | 168 | 11/13/2024 |
| 0.6.3 | 172 | 11/10/2024 |
| 0.6.2 | 163 | 11/10/2024 |
| 0.6.1 | 168 | 10/25/2024 |
| 0.6.0 | 180 | 10/20/2024 |
| 0.5.1 | 164 | 9/29/2024 |
| 0.5.0 | 168 | 9/29/2024 |
| 0.4.0 | 187 | 9/7/2024 |
| 0.3.1 | 390 | 7/12/2024 |
| 0.3.0 | 186 | 7/7/2024 |
| 0.2.2 | 172 | 6/14/2024 |
| 0.2.1 | 185 | 6/13/2024 |
| 0.2.0 | 170 | 6/9/2024 |
| 0.1.0 | 178 | 6/8/2024 |