Conventional commit checker
A colleague added commitlint to a Rust project. Suddenly the repo needed Node.js, npm, Husky, and a node_modules directory just to validate a commit message. The spec is a grammar — parsing it takes milliseconds and has no business pulling in a JavaScript runtime. A single binary is all it needs.
Features
- Validation — checks the full commit against Conventional Commits v1.0.0: header format, body structure, footers, and breaking change detection
- Semantic parser — parses body and footers, not just a header regex;
BREAKING CHANGEis only recognized in the footer section as the spec requires, making it more compliant than most commitlint configurations - Auto-fix —
--fixrewrites common header mistakes (wrong case, trailing period, spacing) and prints the corrected message - Body cleaning — strip AI assistant and CI bot trailers (
Co-authored-by:,Signed-off-by:, custom regexes) before validation; each removed line is reported so nothing disappears silently - Integrated hook management —
commit-check install-hookwrites.git/hooks/commit-msgdirectly; no Husky, no pre-commit framework required - Configurable rules — allowed types, required/allowed scopes, min/max description length, case enforcement, issue tracker footer pattern; set via CLI flags or
.commit-check.toml - JSON output —
--format jsonfor machine-readable results in CI pipelines - Library crate — use
validate_commit,fix_commit_message, andclean_commit_bodydirectly from Rust code - Lightweight — single static binary; pure Rust, no runtime dependencies
Integrations
Local git hook — one command, no extra tooling:
commit-check install-hookGitHub Actions:
- name: Validate commit message
run: git log -1 --pretty=%B | docker run -i slundi/commit-check:latest validateGitLab CI:
commit-msg-check:
image: slundi/commit-check:latest
script: echo "$CI_COMMIT_MESSAGE" | commit-check validate
only: [merge_requests]Woodpecker / Drone CI:
- name: validate-commit
image: slundi/commit-check:latest
commands:
- echo "$${CI_COMMIT_MESSAGE}" | commit-check validate --verbosepre-commit framework (.pre-commit-config.yaml):
repos:
- repo: https://codeberg.org/slundi/conventional-commits
rev: v1.0.0
hooks:
- id: commit-check
stages: [commit-msg]Nix — run without installing:
nix run github:slundi/conventional-commits -- validate --message "feat: nix support"Comparison
| commit-check | commitlint | commitizen | |
|---|---|---|---|
| Runtime required | none | ❌ Node.js | ❌ Node.js / Python |
| Single static binary | ✅ | ❌ | ❌ |
| Hook management built-in | ✅ install-hook | ❌ needs Husky | ❌ needs Husky |
| Semantic footer parsing | ✅ | Partial (regex) | ❌ |
| Auto-fix | ✅ --fix | ❌ | ❌ |
| Body / trailer cleaning | ✅ | ❌ | ❌ |
| JSON output | ✅ | ✅ | ❌ |
| Usable as a library | ✅ Rust crate | ❌ | ❌ |
| Docker image | ✅ | ✅ | ❌ |
| Interactive commit wizard | ❌ | ❌ | ✅ |
commitizen’s interactive prompt for guided commit creation is out of scope for this tool — it focuses on validation, not authoring.
Installation
cargo install conventional-commitsDocker:
echo "feat: add login" | docker run -i slundi/commit-check:latest validateNix flake — no install needed:
nix run github:slundi/conventional-commits -- validate --message "feat: nix support"