Skip to content

Commit 06b3988

Browse files
committed
feat: move to gitlint
1 parent a76475c commit 06b3988

File tree

6 files changed

+241
-15
lines changed

6 files changed

+241
-15
lines changed

.gitlint

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Edit this file as you like.
2+
#
3+
# All these sections are optional. Each section with the exception of [general] represents
4+
# one rule and each key in it is an option for that specific rule.
5+
#
6+
# Rules and sections can be referenced by their full name or by id. For example
7+
# section "[body-max-line-length]" could also be written as "[B1]". Full section names are
8+
# used in here for clarity.
9+
#
10+
# [general]
11+
# Ignore certain rules, this example uses both full name and id
12+
# ignore=title-trailing-punctuation, T3
13+
14+
# verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this
15+
# verbosity = 2
16+
17+
# By default gitlint will ignore merge, revert, fixup, fixup=amend, and squash commits.
18+
# ignore-merge-commits=true
19+
# ignore-revert-commits=true
20+
# ignore-fixup-commits=true
21+
# ignore-fixup-amend-commits=true
22+
# ignore-squash-commits=true
23+
24+
# Ignore any data sent to gitlint via stdin
25+
# ignore-stdin=true
26+
27+
# Fetch additional meta-data from the local repository when manually passing a
28+
# commit message to gitlint via stdin or --commit-msg. Disabled by default.
29+
# staged=true
30+
31+
# Hard fail when the target commit range is empty. Note that gitlint will
32+
# already fail by default on invalid commit ranges. This option is specifically
33+
# to tell gitlint to fail on *valid but empty* commit ranges.
34+
# Disabled by default.
35+
# fail-without-commits=true
36+
37+
# Whether to use Python `search` instead of `match` semantics in rules that use
38+
# regexes. Context: https://github.com/jorisroovers/gitlint/issues/254
39+
# Disabled by default, but will be enabled by default in the future.
40+
# regex-style-search=true
41+
42+
# Enable debug mode (prints more output). Disabled by default.
43+
# debug=true
44+
45+
# Enable community contributed rules
46+
# See http://jorisroovers.github.io/gitlint/contrib_rules for details
47+
# contrib=contrib-title-conventional-commits,CC1
48+
49+
# Set the extra-path where gitlint will search for user defined rules
50+
# See http://jorisroovers.github.io/gitlint/user_defined_rules for details
51+
# extra-path=examples/
52+
53+
# This is an example of how to configure the "title-max-length" rule and
54+
# set the line-length it enforces to 50
55+
# [title-max-length]
56+
# line-length=50
57+
58+
# Conversely, you can also enforce minimal length of a title with the
59+
# "title-min-length" rule:
60+
# [title-min-length]
61+
# min-length=5
62+
63+
# [title-must-not-contain-word]
64+
# Comma-separated list of words that should not occur in the title. Matching is case
65+
# insensitive. It's fine if the keyword occurs as part of a larger word (so "WIPING"
66+
# will not cause a violation, but "WIP: my title" will.
67+
# words=wip
68+
69+
# [title-match-regex]
70+
# python-style regex that the commit-msg title must match
71+
# Note that the regex can contradict with other rules if not used correctly
72+
# (e.g. title-must-not-contain-word).
73+
# regex=^US[0-9]*
74+
75+
# [body-max-line-length]
76+
# line-length=72
77+
78+
# [body-min-length]
79+
# min-length=5
80+
81+
# [body-is-missing]
82+
# Whether to ignore this rule on merge commits (which typically only have a title)
83+
# default = True
84+
# ignore-merge-commits=false
85+
86+
# [body-changed-file-mention]
87+
# List of files that need to be explicitly mentioned in the body when they are changed
88+
# This is useful for when developers often erroneously edit certain files or git submodules.
89+
# By specifying this rule, developers can only change the file when they explicitly reference
90+
# it in the commit message.
91+
# files=gitlint-core/gitlint/rules.py,README.md
92+
93+
# [body-match-regex]
94+
# python-style regex that the commit-msg body must match.
95+
# E.g. body must end in My-Commit-Tag: foo
96+
# regex=My-Commit-Tag: foo$
97+
98+
# [author-valid-email]
99+
# python-style regex that the commit author email address must match.
100+
# For example, use the following regex if you only want to allow email addresses from foo.com
101+
# regex=[^@][email protected]
102+
103+
# [ignore-by-title]
104+
# Ignore certain rules for commits of which the title matches a regex
105+
# E.g. Match commit titles that start with "Release"
106+
# regex=^Release(.*)
107+
108+
# Ignore certain rules, you can reference them by their id or by their full name
109+
# Use 'all' to ignore all rules
110+
# ignore=T1,body-min-length
111+
112+
# [ignore-by-body]
113+
# Ignore certain rules for commits of which the body has a line that matches a regex
114+
# E.g. Match bodies that have a line that that contain "release"
115+
# regex=(.*)release(.*)
116+
#
117+
# Ignore certain rules, you can reference them by their id or by their full name
118+
# Use 'all' to ignore all rules
119+
# ignore=T1,body-min-length
120+
121+
# [ignore-body-lines]
122+
# Ignore certain lines in a commit body that match a regex.
123+
# E.g. Ignore all lines that start with 'Co-Authored-By'
124+
# regex=^Co-Authored-By
125+
126+
# [ignore-by-author-name]
127+
# Ignore certain rules for commits of which the author name matches a regex
128+
# E.g. Match commits made by dependabot
129+
# regex=(.*)dependabot(.*)
130+
#
131+
# Ignore certain rules, you can reference them by their id or by their full name
132+
# Use 'all' to ignore all rules
133+
# ignore=T1,body-min-length
134+
135+
# This is a contrib rule - a community contributed rule. These are disabled by default.
136+
# You need to explicitly enable them one-by-one by adding them to the "contrib" option
137+
# under [general] section above.
138+
# [contrib-title-conventional-commits]
139+
# Specify allowed commit types. For details see: https://www.conventionalcommits.org/
140+
# types = bugfix,user-story,epic
141+
142+
[general]
143+
ignore=body-is-missing
144+
145+
[title-max-length]
146+
line-length=72
147+
148+
[title-match-regex]
149+
# Enforce conventional commits style
150+
regex=^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z]+\))?: .+$

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ poetry_install:
1313
dependencies: poetry_install
1414
@echo "---- Installing Python dependencies ----"
1515
poetry install
16+
poetry self add poetry-plugin-sembump
1617

1718
git_hooks_init:
1819
@echo "---- Git hooks init (using Gookme) ----"

commitlint.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

hooks/commit-msg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"steps": [{
33
"name": "Lint commit message",
4-
"command": "npx commitlint lint $1"
4+
"command": "poetry run gitlint --msg-filename $1"
55
}]
66
}

poetry.lock

Lines changed: 88 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ types-jsonschema = "^4.20.0.20240105"
4242
yamllint = "1.35.1"
4343
ipykernel = "^6.28.0"
4444
mdformat = "^0.7.21"
45+
gitlint = "^0.19.1"
4546

4647
[build-system]
4748
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)