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
build: add commitlint and husky for commit message validation
- Add package.json with commitlint and husky dependencies
- Configure commitlint with conventional commit rules
- Set up git hook to validate commit messages before creation
- Update .gitignore for Node.js files
- Update CONTRIBUTING.md and README.md with setup instructions
- Prevent commits that don't follow conventional commit format
47
+
5. Create a new branch:
39
48
```bash
40
49
git checkout -b feature/my-feature
41
50
```
@@ -77,6 +86,21 @@ cargo make test-examples
77
86
78
87
This project uses [Conventional Commits](https://www.conventionalcommits.org/) for automated versioning and changelog generation.
79
88
89
+
**Important:** Commit messages are automatically validated using commitlint. Invalid commits will be rejected before they're created.
90
+
91
+
### Commit Validation
92
+
93
+
When you try to commit, a git hook will automatically check your commit message format. If it doesn't follow the conventional commit format, you'll see an error like:
94
+
95
+
```
96
+
⧗ input: bad commit message
97
+
✖ type must be one of [feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert] [type-enum]
98
+
✖ found 1 problems, 0 warnings
99
+
husky - commit-msg hook exited with code 1 (error)
100
+
```
101
+
102
+
To fix this, make sure your commit message follows the format below.
103
+
80
104
### Commit Message Format
81
105
82
106
```
@@ -279,6 +303,34 @@ Releases are automated using semantic-release:
279
303
- Creates GitHub release
280
304
- Publishes Docker image
281
305
306
+
## Troubleshooting
307
+
308
+
### Commit Validation Not Working
309
+
310
+
If commit validation isn't working:
311
+
312
+
1. Make sure you ran `npm install` after cloning the repository
313
+
2. Check that `.husky/commit-msg` exists and is executable
314
+
3. Reinstall hooks: `npm run prepare`
315
+
316
+
### Bypassing Commit Validation (NOT Recommended)
317
+
318
+
In rare cases, you may need to bypass validation (e.g., fixing a broken commit history):
319
+
320
+
```bash
321
+
git commit --no-verify -m "your message"
322
+
```
323
+
324
+
**Warning:** Only use `--no-verify` when absolutely necessary, as it will bypass the commit validation.
325
+
326
+
### Testing Commit Messages
327
+
328
+
You can test a commit message without making a commit:
3. Create a feature branch (`git checkout -b feature/amazing-feature`)
994
+
4. Make your changes
995
+
5. Run tests and QA checks (`cargo make qa`)
996
+
6. Commit using [conventional commits](#commit-convention) - invalid commits will be automatically rejected
997
+
7. Push to your fork
998
+
8. Open a Pull Request
999
+
1000
+
**Note:** Commit messages are automatically validated. If your commit is rejected, make sure it follows the [conventional commit format](#commit-convention).
0 commit comments