Contrib Rules
Introduction¶
Contrib rules are community-contributed rules that are disabled by default, but can be enabled through configuration.
Contrib rules are meant to augment default gitlint behavior by providing users with rules for common use-cases without forcing these rules on all gitlint users. This also means that users don't have to re-implement these commonly used rules themselves as user-defined rules.
Example:
$ gitlint
1: CC1 Body does not contain a 'Signed-off-by' line
1: CL1 Title does not start with one of fix, feat, chore, docs, style, refactor, perf, test: "WIP: This is the title of a commit message."
To enable contrib rules:
[general]
# You HAVE to add the rule to [general] to enable it
# Only configuring (such as below) does NOT enable it.
contrib = contrib-title-conventional-commits,CC1
# Setting contrib rule options is identical to configuring other rules
[contrib-title-conventional-commits]
types = bugfix,user-story,epic
Available contrib rules¶
CT1: contrib-title-conventional-commits¶
v0.12.0 · ID: CT1 · Name: contrib-title-conventional-commits
Enforces Conventional Commits commit message style on the title.
Options¶
Name | Type | Default | gitlint version | Description |
---|---|---|---|---|
types |
str |
fix,feat,chore,docs,style,refactor,perf,test,revert,ci,build |
v0.12.0 | Comma separated list of allowed commit types. |
CC1: contrib-body-requires-signed-off-by¶
v0.12.0 · ID: CC1 · Name: contrib-body-requires-signed-off-by
Commit body must contain a line that starts with Signed-off-by
.
CC2: contrib-disallow-cleanup-commits¶
v0.18.0 · ID: CC2 · Name: contrib-disallow-cleanup-commits
Commit title must not contain fixup!
, squash!
or amend!
. This means git commit --fixup
and git commit --squash
commits are not allowed.
CC3: contrib-allowed-authors¶
v0.18.0 · ID: CC3 · Name: contrib-allowed-authors
The commit author must be listed in an AUTHORS
(or AUTHORS.txt
or AUTHORS.md
) file to be allowed to commit.
Contributing Contrib rules¶
We'd love for you to contribute new Contrib rules to gitlint or improve existing ones! Please visit the Contributing page on how to get started.