Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit b83ed5c

Browse files
committed
feat: replace commitlint with gitlint (#51)
1 parent ba1a432 commit b83ed5c

File tree

4 files changed

+157
-54
lines changed

4 files changed

+157
-54
lines changed

.commitlintrc.json

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

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: CI
2+
on: [push, pull_request]
3+
jobs:
4+
gitlint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
with:
9+
fetch-depth: 0
10+
- name: Install gitlint
11+
run: pip install gitlint
12+
- name: Validate current commit (last commit) with gitlint
13+
if: github.event_name == 'push'
14+
run: gitlint
15+
- name: Validate PR commits with gitlint
16+
if: github.event_name == 'pull_request'
17+
run: gitlint --commits ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }},${{ github.event.pull_request.head.sha }}

.github/workflows/commitlint.yml

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

.gitlint

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
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=CC1, B6
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=[^@]+@foo.com
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

0 commit comments

Comments
 (0)