CommitLint.Net 0.8.0

dotnet tool install --global CommitLint.Net --version 0.8.0
                    
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 CommitLint.Net --version 0.8.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CommitLint.Net&version=0.8.0
                    
nuke :add-package CommitLint.Net --version 0.8.0
                    

What is CommitLint.Net?

It is a dotnet tool for validating commit messages according to Conventional Commits specification. It can be used in git hook, for example with Husky.NET. It is also included in xpd project.

How to use

Install

dotnet new tool-manifest # if this is your first local dotnet tool in this project
dotnet tool install CommitLint.Net

Configure Husky.NET

Install & configure Husky.NET (there is slight difference between platform in parsing $1 argument):

MacOS
dotnet tool install Husky
dotnet husky install
dotnet husky add commit-msg -c "dotnet husky run --group commit-msg --args \"\$1\""
Windows
dotnet tool install Husky
dotnet husky install
dotnet husky add commit-msg -c 'dotnet husky run --group commit-msg --args """$1"""'

In the end, entry in commit-msg file that will be created by dotnet husky add should be:

dotnet husky run --group commit-msg --args "$1"

Then in .husky/task-runner.json add task to run linter:

{
  "$schema": "https://alirezanet.github.io/Husky.Net/schema.json",
  "tasks": [
    {
      "name": "commit-message-linter",
      "group": "commit-msg",
      "command": "dotnet",
      "args": [
        "commit-lint",
        "--commit-file",
        "${args}"
      ]
    }
  ]
}

Custom config

CommitLint.Net uses default configuration which is the following:

{
    "config": {
        "max-subject-length": {
            "enabled": true,
            "value": 90
        },
        "conventional-commit": {
            "enabled": true,
            "types": [ "feat", "fix", "refactor", "build", "chore", "style", "test", "docs", "perf", "revert" ],
            "scopes": {
                "enabled": false,
                "global": [],
                "per-type": {
                    "feat": [],
                    "fix": [],
                    "refactor": [],
                    "build": [],
                    "chore": [],
                    "style": [],
                    "test": [],
                    "docs": [],
                    "perf": [],
                    "revert": []
                }
            }
        }
    }
}

If you want to change it, create json file, e.g. commit-message-config.json with above content and modify options as needed. Options listed above are all currently supported options.

If you're using Husky, then you'll also need to add this custom config to task-runner.json with --commit-message-config-file option:

{
  "name": "commit-message-linter",
  "group": "commit-msg",
  "command": "dotnet",
  "args": [
    "commit-lint",
    "--commit-file",
    "${args}",
    "--commit-message-config-file",
    "path/to/commit-message-config.json"
  ]
}

path/to/commit-message-config.json is relative to root of your repo.

Config options
  • Max subject length - max length of commit subject (whole first line) (default: 90 characters)
  • Commit types - list of allowed commit types
  • Commit scopes - list of allowed commit scopes. Disabled by default (any scope is allowed). Empty lists mean that any scope is allowed. When configured with some values, only those scopes are allowed.
    • Global: list of allowed scopes for all types that are not listed in per-type config.
    • Per-type: list of allowed scopes for each type. You can define only the types you want and leave the rest empty.

Direct usage

If you'd like to use it directly, without Husky:

dotnet commit-lint --commit-file "path/to/commit-message.txt" --commit-message-config-file "path/to/commit-message-config.json"

Current Rules

Conventional Commits specification rules

  1. Scope format check
  2. Type format check + if it is on allowed list
  3. Description not empty check
  4. Blank line before body check
  5. Body not empty check
  6. Blank line before footers check
  7. Optional "!" character after type/scope for breaking change check
  8. Breaking change token in footer format check
  9. Footers content not empty check

Note: can be disabled in config by setting conventional-commit.enabled to false.

Additional checks on conventional commits rules

  1. Allowed scopes check - you can configure allowed scopes as described in Config options

Note: can be disabled in config by setting conventional-commit.scopes.enabled to false.

Additional rules

  1. Max subject length check

Note: can be disabled in config by setting max-subject-length.enabled to false.

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.  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. 
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
0.8.0 130 8/9/2025
0.7.0 433 1/7/2025
0.6.0 158 12/18/2024
0.5.3 152 12/14/2024
0.5.2 117 12/14/2024
0.5.1 130 12/3/2024
0.5.0 117 12/3/2024
0.4.0 104 12/2/2024
0.3.0 160 11/26/2024
0.2.0 106 11/18/2024
0.1.0 108 11/17/2024