Skip to content

sickagents/semantic-commit-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commit Lint

A lightweight, zero-dependency commit message validator that enforces Conventional Commits specification.

Features

  • ✅ 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

Installation

# 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.sh

Usage

As a Git Hook

After installation, the validator runs automatically on every commit:

git commit -m "feat: add new feature"  # ✅ Valid
git commit -m "fixed bug"              # ❌ Invalid

As a Standalone CLI

# 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

Commit Message Format

<type>(<scope>): <subject>

<body>

<footer>

Types

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting, semicolons, etc)
  • refactor: Code refactoring
  • perf: Performance improvements
  • test: Adding or updating tests
  • chore: Build process or auxiliary tool changes
  • ci: CI/CD configuration changes
  • build: Build system changes
  • revert: Revert a previous commit

Examples

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"

Configuration

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
}

License

MIT License - see LICENSE for details

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

About

A lightweight, zero-dependency commit message validator for Conventional Commits

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors