Cranky 1.4.4

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Cranky --version 1.4.4
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Cranky --version 1.4.4
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Cranky&version=1.4.4
nuke :add-package Cranky --version 1.4.4

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. Repeatable.

  • -s|--solution <sln>: Specify a .sln file to analyze the entire solution. (only csproj projects are analyzed)

  • -x|--exclude <pattern>: Specify a pattern to exclude projects from analysis. Supports glob patterns. Repeatable.

  • --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

# Exclude test projects
cranky -s MySolution.sln --exclude *.Tests*

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.5.1 167 4/11/2024
1.5.0 118 4/11/2024
1.4.4 298 12/14/2023
1.4.3 145 12/14/2023
1.4.2 161 12/5/2023
1.4.1 199 11/24/2023
1.4.0 182 11/24/2023
1.3.1 291 10/30/2023
1.3.0 199 10/30/2023
1.2.4 189 10/26/2023
1.2.3 238 10/26/2023
1.2.2 230 10/25/2023
1.2.1 197 10/25/2023
1.2.0 228 10/25/2023
1.1.0 211 10/23/2023
1.0.0 231 10/23/2023
0.1.0 105 10/23/2023

1.4.4
-----
* Include README.md in nupkg
1.4.3
-----
* Added new parameter: `-x` or `--exclude` to specify a pattern to exclude projects from analysis. Supports glob patterns and is repeatable.