Cranky 1.4.2
See the version list below for details.
dotnet tool install --global Cranky --version 1.4.2
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Cranky --version 1.4.2
#tool dotnet:?package=Cranky&version=1.4.2
nuke :add-package Cranky --version 1.4.2
Cranky - .NET API Documentation Coverage Analyzer
Cranky is a command-line tool for analyzing the documentation coverage of public APIs in your .NET projects and solutions. It helps you ensure that your public APIs are adequately documented. This README provides an overview of how to use Cranky and its features.
Features
Cranky supports the following command-line arguments:
-p|--project <csproj>: Specify a .csproj file to analyze.
-s|--solution <sln>: Specify a .sln file to analyze the entire solution.
--github: Enable output compatible with GitHub actions.
--json: Enable output in JSON format.
--percentages <min,accept>: Specify minimum and acceptable thresholds for coverage as two comma-separated numbers. By default, these values are 50 and 90.
-e|--set-exit-code: Set an exit code other than 0 if coverage is below the minimum. By default, the exit code is not set.
--debug: Enable build output for debugging.
The default output just writes information to stdout (including ANSI color codes).
JSON Output
When using the --json
option, Cranky outputs the following JSON:
{
"Messages": [
{
"Type": "info",
"Message": "Documentation coverage passed \u2705"
}
],
"Result": {
"total": 708,
"documented": 412,
"undocumented": 296,
"percent": 58,
"health": "\u2705",
"message": "Documentation coverage passed \u2705",
"badge": "https://img.shields.io/badge/Documentation%20Coverage-58%25-brightgreen"
}
}
GitHub Actions Integration
When using the --github
option, Cranky provides the following outputs for use in GitHub actions:
total: The total number of public API members that need documentation.
undocumented: The number of undocumented API members.
documented: The number of documented API members.
percent: A percentage between 0 and 100 showing the total coverage.
health: An emoji to indicate the coverage status (❌ = error, ⚠️ = warning, ✅ = success).
badge: A badge showing the coverage with an indicator color.
message: A text message stating the coverage status.
Usage
To analyze a project, use the -p
option and provide the path to the .csproj file. For analyzing a solution, use the -s
option and specify the .sln file.
Example usage:
# Analyze a project/solution in the current directory
cranky
# Analyze a solution with custom percentage thresholds
cranky -s MySolution.sln --percentages 40,85
# Analyze a project, output for GitHub Actions and set exit code
cranky -p MyProject.csproj --github --set-exit-code
GitHub Actions Workflow
To integrate Cranky with GitHub actions, include the following step in your workflow file:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Cranky
id: docblocks
run: dotnet tool update cranky -g && cranky --project ./MyProject.csproj --github --set-exit-code --percentages 0,50
- name: Report Results
run: |
echo "Docblock Coverage: ${{ steps.docblocks.outputs.percent }}%"
This will run Cranky with GitHub actions-compatible output.
License
This project is licensed under the MIT License.
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. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
1.5.1 | 363 | 4/11/2024 |
1.5.0 | 149 | 4/11/2024 |
1.4.4 | 342 | 12/14/2023 |
1.4.3 | 191 | 12/14/2023 |
1.4.2 | 202 | 12/5/2023 |
1.4.1 | 248 | 11/24/2023 |
1.4.0 | 238 | 11/24/2023 |
1.3.1 | 337 | 10/30/2023 |
1.3.0 | 248 | 10/30/2023 |
1.2.4 | 236 | 10/26/2023 |
1.2.3 | 287 | 10/26/2023 |
1.2.2 | 277 | 10/25/2023 |
1.2.1 | 248 | 10/25/2023 |
1.2.0 | 279 | 10/25/2023 |
1.1.0 | 255 | 10/23/2023 |
1.0.0 | 291 | 10/23/2023 |
0.1.0 | 133 | 10/23/2023 |
Fix problem with options parsing.