CommitLint.Net 0.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global CommitLint.Net --version 0.3.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.3.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CommitLint.Net&version=0.3.0                
nuke :add-package CommitLint.Net --version 0.3.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.

It doesn't have a full set of rules yet.

How to use

Install

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

Create config

Create file commit-message-config.json with following content:

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

These are currently supported options.

Configure Husky.NET

Install & configure Husky.NET:

dotnet tool install Husky.Net
dotnet husky install
dotnet husky run --group commit-msg

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}",
        "--commit-message-config-file",
        "path/to/commit-message-config.json"
      ]
    }
  ]
}

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"
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
0.6.0 65 12/18/2024
0.5.3 112 12/14/2024
0.5.2 74 12/14/2024
0.5.1 85 12/3/2024
0.5.0 83 12/3/2024
0.4.0 72 12/2/2024
0.3.0 130 11/26/2024
0.2.0 79 11/18/2024
0.1.0 79 11/17/2024