A lightweight, zero-dependency commit message validator that enforces Conventional Commits specification.
- ✅ Validates commit messages against Conventional Commits format
- 🚀 Zero dependencies - pure Python
- 🎯 Works as a Git hook or standalone CLI
- 📝 Supports custom types and scopes
- 🔧 Configurable via
.commitlintrc.json - 🎨 Colored output for better readability
# Clone the repository
git clone https://github.com/sickagents/commit-lint.git
cd commit-lint
# Make the script executable
chmod +x commit-lint.py
# Install as a Git hook (optional)
./install-hook.shAfter installation, the validator runs automatically on every commit:
git commit -m "feat: add new feature" # ✅ Valid
git commit -m "fixed bug" # ❌ Invalid# Validate a commit message
./commit-lint.py "feat(api): add user authentication"
# Validate from stdin
echo "fix: resolve memory leak" | ./commit-lint.py --stdin
# Check the last commit
./commit-lint.py --last<type>(<scope>): <subject>
<body>
<footer>
feat: A new featurefix: A bug fixdocs: Documentation changesstyle: Code style changes (formatting, semicolons, etc)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testschore: Build process or auxiliary tool changesci: CI/CD configuration changesbuild: Build system changesrevert: Revert a previous commit
feat(auth): add OAuth2 authentication
fix(api): resolve null pointer exception
docs: update installation guide
style: format code with prettier
refactor(core): simplify validation logic
perf: optimize database queries
test(api): add integration tests
chore: update dependencies
ci: add GitHub Actions workflow
build: configure webpack
revert: revert "feat: add new feature"
Create a .commitlintrc.json file in your repository root:
{
"types": [
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"chore",
"ci",
"build",
"revert"
],
"scopes": ["api", "core", "ui", "auth"],
"min_subject_length": 10,
"max_subject_length": 72
}MIT License - see LICENSE for details
Contributions are welcome! Please open an issue or submit a pull request.