EasyBuild.CommitLinter
2.0.0
dotnet tool install --global EasyBuild.CommitLinter --version 2.0.0
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local EasyBuild.CommitLinter --version 2.0.0
#tool dotnet:?package=EasyBuild.CommitLinter&version=2.0.0
nuke :add-package EasyBuild.CommitLinter --version 2.0.0
EasyBuild.CommitLinter
EasyBuild.CommitLinter is a .NET tool to lint your commit messages. It checks if the commit message follows the commit format described below.
[!TIP] EasyBuild.CommitLinter has a companion tool called EasyBuild.ChangelogGen which generates a changelog based on the Git history.
Usage
# Install the tool
dotnet tool install EasyBuild.CommitLinter
# Run the tool
dotnet commit-linter --help
DESCRIPTION:
Lint your commit message based on EasyBuild.CommitLinter conventions
Learn more at https://github.com/easybuild-org/EasyBuild.CommitLinter
USAGE:
commit-linter <commit-file> [OPTIONS]
ARGUMENTS:
<commit-file> Path to the commit message file
OPTIONS:
-h, --help Prints help information
-v, --version Prints version information
-c, --config Path to the configuration file
Husky Integration
If you are using Husky, you can register the CLI as a commit-msg
hook to validate your commit messages by running:
dotnet husky add commit-msg -c 'dotnet commit-linter "$1"'
# $1 is provided by Husky and contains the path to the commit message file
Commit Format
[!NOTE] EasyBuild.CommitParser format is based on Conventional Commits
It add a special
Tag
footer, allowing it to be used in a mono-repo context.Tools like EasyBuild.ChangelogGen can use the tag to filter the commits to include in the changelog.
<type>[optional scope][optional !]: <description>
[optional body]
[optional footer]
[optional body]
is a free-form text.This is a single line body.
This is a multi-line body.
[optional footer]
is inspired by git trailer formatkey: value
but also allowskey #value
BREAKING CHANGE: <description> Signed-off-by: Alice <alice@example.com> Signed-off-by: Bob <bob@example.com> Refs #123 Tag: cli
💡 The
Tag
footer can be provided multiple times.
Configuration
EasyBuild.CommitParser comes with a default configuration to validate your commit.
The default configuration allows the following commit types with no tags required:
feat
- A new featurefix
- A bug fixci
- Changes to CI/CD configurationchore
- Changes to the build process or auxiliary tools and libraries such as documentation generationdocs
- Documentation changestest
- Adding missing tests or correcting existing testsstyle
- Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor
- A code change that neither fixes a bug nor adds a featureperf
- A code change that improves performancerevert
- Reverts a previous commitbuild
- Changes that affect the build system or external dependencies
If needed, you can provide a custom configuration either by code directly or by using a configuration file using JSON format.
Configuration File Format
The configuration file is a JSON file with the following properties:
types
- Required: ✅
- Type:
{ name: string, description?: string, skipTagFooter?: bool } []
List of accepted commit types.
Property | Type | Required | Description |
---|---|---|---|
name | string | ✅ | The name of the commit type. |
description | string | ❌ | The description of the commit type. |
skipTagFooter | bool | ❌ | If true skip the tag footer validation. <br> If false , checks that the tag footer is provided and contains knows tags. <br><br>Default is true . |
tags
- Required: ❌
- Type:
string []
List of accepted commit tags.
Examples
{
"types": [
{ "name": "feat", "description": "A new feature", "skipTagFooter": false },
{ "name": "perf", "description": "A code change that improves performance", "skipTagFooter": false },
{ "name": "fix", "description": "A bug fix", "skipTagFooter": false },
{ "name": "docs", "description": "Documentation changes", "skipTagFooter": false },
{ "name": "test", "description": "Adding missing tests or correcting existing tests", "skipTagFooter": false },
{ "name": "style", "description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)", "skipTagFooter": false },
{ "name": "refactor", "description": "A code change that neither fixes a bug nor adds a feature", "skipTagFooter": false },
{ "name": "ci", "description": "Changes to CI/CD configuration" },
{ "name": "chore", "description": "Changes to the build process or auxiliary tools and libraries such as documentation generation" }
{ "name": "revert", "description": "Reverts a previous commit" }
{ "name": "build", "description": "Changes that affect the build system or external dependencies" }
],
"tags": [
"cli",
"converter"
]
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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.
### 🏗️ Breaking changes
* Add `perf`, `revert` and `build` commit type to be on par with Angular convention (most common one) ([9bba64c](https://github.com/easybuild-org/commit-linter/commit/9bba64cf4315a574403e3ba7b8c51f6160ccef91))
<strong><small>[View changes on Github](https://github.com/easybuild-org/commit-linter/compare/703531d83302632ddbfdf698a0bf7c0f05afb95a..2d8589520fcff3892dcf2df50b416efd1b19c05f)</small></strong>