Skip to content

Commit a68a810

Browse files
committed
style: start using conventional commits
1 parent dd75696 commit a68a810

File tree

5 files changed

+81
-17
lines changed

5 files changed

+81
-17
lines changed

.github/workflows/lint.yml

+20
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@ jobs:
3737
- name: Check for changes
3838
run: if [[ -n $(git status -s) ]]; then exit 1; fi
3939

40+
gitlint:
41+
name: Gitlint
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: actions/setup-python@v3
46+
with:
47+
python-version: '3.11'
48+
- name: Install gitlint
49+
run: pip install gitlint
50+
- name: Run gitlint
51+
run: |
52+
if [[ -z "${GITHUB_BASE_REF}" ]]; then
53+
BASE=origin/main
54+
else
55+
BASE="${GITHUB_BASE_REF}"
56+
fi
57+
echo "Linting: ${BASE}..HEAD"
58+
gitlint --commits ${BASE}..HEAD
59+
4060
case-sensitivity:
4161
name: File case sensitivity
4262
runs-on: ubuntu-latest

.gitlint

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[general]
2+
ignore=body-is-missing
3+
contrib=contrib-title-conventional-commits
4+
5+
verbosity = 3
6+
7+
ignore-merge-commits=true
8+
ignore-revert-commits=true
9+
ignore-fixup-commits=true
10+
ignore-fixup-amend-commits=true
11+
ignore-squash-commits=true
12+
13+
[contrib-title-conventional-commits]
14+
types=ci,docs,feat,fix,refactor,revert,style,test

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@ repos:
1111
language: system
1212
entry: make --silent documentation
1313
types: []
14+
- id: gitlint
15+
name: Gitlint
16+
language: system
17+
entry: gitlint --msg-filename
18+
stages: [commit-msg]
19+
types: []

CONTRIBUTING.md

+40-16
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,64 @@ All well-intentioned, polite, and respectful contributions are always welcome! T
2020
## Commit messages
2121

2222
- Try to make commit message as concise as possible while giving enough information about nature of a change. Think about whether it will be easy to understand in one year time when browsing through commit history.
23-
- Use two part structure:
24-
- First part is a change overview in present tense, preferably in single line under 80 characters. Should end with a period. Usually should be enough.
2523

26-
**If commit affects only one particular module (as it usually should), prepend with "(mini.\<module-name\>) ".** If commit ensures something for all modules but not necessary touches all of them, use "(all) ".
24+
- Single commit should change either zero or one module, or affect all modules (i.e. enforcing some universal rule but not necessarily change files). Changes for two or more modules should be split in several module-specific commits.
2725

28-
- Second part is optional and should contain details about the change after empty line and "Details:". Use bullet list with `-`.
26+
- Use [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) style:
27+
- Messages should follow the following structure:
2928

30-
Use "Resolves #xxx" as separate entry if this commit resolves issue or PR.
29+
```
30+
<type>[optional scope]: <description>
3131

32-
- Use these prefixes after initial module name in described situations:
33-
- "FEATURE:" - if change implements new feature (like option or function).
34-
- "BREAKING:" - if change breaks current documented behavior.
35-
- "BREAKING FEATURE:" - if change introduces new feature while breaking current documented behavior.
36-
- "NEW MODULE:" - if change introduces new module (see 'MAINTAINING.md').
32+
[optional body]
33+
34+
[optional footer(s)]
35+
```
36+
37+
- `<type>` is **mandatory** and can be one of: `ci`, `docs`, `feat`, `fix`, `refactor`, `revert`, `style`, `test`. Rule of thumb: use `docs`, `feat`, or `fix` if it is meant as change users might be interested to see; others otherwise.
38+
- `[optional scope]`, if present, should be done in parenthesis `()`. If commit changes single module (as it usually should), using scope with module name is **mandatory**. If commit enforces something for all modules, use `ALL` scope.
39+
- Breaking change should be expressed with `!` before `:`.
40+
- `<description>` is a change overview in imperative, present tense ("change" not "changed" nor "changes"). Should result into first line under 72 characters. Should NOT end with a period.
41+
- `[optional body]`, if present, should contain details and motivation about the change in plain language. Should be formatted to have maximum 80 characters in line.
42+
- `[optional footer(s)]`, if present, should be instructions to Git or Github. Use "Resolves #xxx" as separate entry if this commit resolves issue or PR.
3743

3844
- Use module's function and field names without module's name. Like `add()` and not `MiniSurround.add()`.
3945

4046
Examples:
4147

4248
```
43-
Fix typo in 'README.md'.
49+
feat(deps): add folds in update confirmation buffer
50+
```
51+
52+
```
53+
fix(jump): make operator not delete one character if target is not found
54+
55+
One main goal is to do that in a dot-repeatable way, because this is very
56+
likely to be repeated after an unfortunate first try.
57+
58+
Resolves #688
59+
```
60+
4461
```
62+
refactor(bracketed): update `treesitter()` to not source 'vim.treesitter' on `require()`
4563
64+
Although less explicit, this considerably reduces startup footprint of
65+
'mini.bracketed' in isolation.
4666
```
47-
(mini.animate) Update `cursor` to use virtual columns.
4867

49-
Details:
50-
- Resolves #258.
68+
```
69+
feat(hues)!: update verbatim text to be distinctive
5170
```
5271

5372
```
54-
(mini.comment) FEATURE: add `options.pad_comment_leaders` option.
73+
test(ALL): update screenshots to work on Nightly
5574
```
5675

76+
### Automation
77+
78+
- [Install `gitlint`](https://jorisroovers.com/gitlint/latest/installation/).
79+
- Lint manually with `gitlint` after the commit or better yet [install pre-commit](https://pre-commit.com/#install) and enable it with `pre-commit install` (from the root directory). This will auto-lint commit message before finalizing it.
80+
5781
## Generating help file
5882

5983
If your contribution updates annotations used to generate help file, please regenerate it. You can make this with one of the following (assuming current directory being project root):
@@ -76,7 +100,7 @@ If you have Windows or MacOS and want to contribute code related change, make yo
76100

77101
This project uses [StyLua](https://github.com/JohnnyMorganz/StyLua) version 0.14.0 for formatting Lua code. Before making changes to code, please:
78102

79-
- [Install StyLua](https://github.com/JohnnyMorganz/StyLua#installation). NOTE: use `v0.14.0`.
103+
- [Install StyLua](https://github.com/JohnnyMorganz/StyLua#installation). NOTE: use `v0.19.0`.
80104
- Format with it. Currently there are two ways to do this:
81105
- Manually run `stylua .` from the root directory of this project.
82106
- [Install pre-commit](https://pre-commit.com/#install) and enable it with `pre-commit install` (from the root directory). This will auto-format relevant code before making commits.

MAINTAINING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Usual workflow involves performing these steps after every commit in 'mini.nvim'
5656
- Update main README to mention new module in table of contents.
5757
- Update 'CHANGELOG.md' to mention introduction of new module.
5858
- Update 'CONTRIBUTING.md' to mention new highlight groups (if there are any).
59-
- Commit changes with message '(mini.xxx) NEW MODULE: initial commit.'. NOTE: it is cleaner to synchronize standalone repositories prior to this commit.
59+
- Commit changes with message 'feat(xxx): add NEW MODULE'. NOTE: it is cleaner to synchronize standalone repositories prior to this commit.
6060
- If there are new highlight groups, follow up with adding explicit support in color scheme modules.
6161
- Make standalone plugin:
6262
- Create new empty GitHub repository. Disable Issues and limit PRs.

0 commit comments

Comments
 (0)