You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci(pre-commit): add gitlint hook for commit message validation
- Add gitlint hook to .pre-commit-config.yaml on commit-msg stage
- Update CONTRIBUTING.md to document both pre-commit hook installation commands
- Clarify that commit-msg hook is required for gitlint validation
Signed-off-by: Mustafa Kaptan <[email protected]>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+56-6Lines changed: 56 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,12 +48,19 @@ The rest of this document assumes you are in the virtual environment by either a
48
48
49
49
### Pre-Commit-Hooks
50
50
51
-
Precommit hooks can be setup with:
51
+
Pre-commit hooks can be set up with:
52
52
53
53
```bash
54
54
pre-commit install
55
+
pre-commit install --hook-type commit-msg
55
56
```
56
57
58
+
The first command installs hooks that run before commits (code formatting, linting, etc.).
59
+
The second command installs the `commit-msg` hook that validates commit messages using gitlint.
60
+
61
+
> [!NOTE]
62
+
> Both hooks are required: the first validates your code, the second enforces conventional commit message standards as described in the [Commit Message Enforcement](#commit-message-enforcement) section.
63
+
57
64
### Tests
58
65
59
66
Run tests with the following command:
@@ -121,6 +128,23 @@ We use [**gitlint**](https://github.com/jorisroovers/gitlint) to enforce convent
121
128
- Custom title length limits (5-100 characters)
122
129
- Ignores GitHub Actions bot commits
123
130
131
+
> [!TIP]
132
+
> **Recovering failed commit messages**: If gitlint rejects your commit, Git saves your message in `.git/COMMIT_EDITMSG`. Recover it with:
0 commit comments