A pre-commit hook to check Conventional Commits and add emojis.
Project description
Conventional Commits Check
conventional-commits-check
is a Python pre-commit hook that enforces Conventional Commits rules on your commit messages and automatically adds relevant emojis based on the commit type.
Conventional Commits is a lightweight convention that provides a set of rules for creating an explicit commit history. This pre-commit hook helps ensure your commit messages adhere to the convention and provides additional context with emojis.
Automatic Emoji Insertion
Automatic emoji insertion at the beginning of the Commit 🎉
{
"feat": "✨",
"fix": "🐛",
"docs": "📚",
"style": "💎",
"refactor": "🧹",
"perf": "🚀",
"test": "🧪",
"build": "🏗️",
"ci": "👷",
"chore": "♻️",
"revert": "⏪",
}
Customization
touch conventional_commits_check_config.yaml
To add custom commit types and emojis, update your conventional_commits_check_config.yaml
file with the additional_commands and additional_emojis fields. Here's an example:
additional_commands:
database: "^database(\\(.+\\))?:"
design: "^design(\\(.+\\))?:"
additional_emojis:
database: "🗃️"
design: "🎨"
Features
- Checks if commit messages follow the Conventional Commits rules.
- Adds an emoji to the commit message based on the commit type.
- Blocks commits with non-conforming messages.
Installation
Follow these steps to add the conventional-commits-check
pre-commit hook to your project:
- In your project's root directory, open the existing
.pre-commit-config.yaml
file (or create one if it doesn't exist) and add the following content:
repos:
- repo: https://github.com/AliYmn/conventional-commits-check
rev: v0.3.0 # Use the latest release version
hooks:
- id: conventional-commits-check
stages: [commit-msg]
- Update the pre-commit hooks in your project:
pre-commit install --hook-type commit-msg -f
- Install the conventional-commits-check package:
pip install conventional-commits-check
- You may need to update the pre-commit package;
pre-commit autoupdate
Usage
Once the hook is added to your project, it will automatically run every time you create a commit. The hook will check the commit messages according to the Conventional Commits rules and add the corresponding emojis. If a commit message does not follow the rules, the commit will be blocked.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for conventional-commits-check-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 196b72c83e345b41729a3422aa834b261d5e5f75f1ca81eba1476fc6486decb0 |
|
MD5 | fa5a2da02d847b130a6a54ecb32015ad |
|
BLAKE2b-256 | e22eb3d2cd8ed26feb7a0db39da616da25e0e93e398cbce342864e65995ae3cc |
Hashes for conventional_commits_check-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dcb433b3a98581ec0bbbb3839ff063415f09bfb229af67d44877be4ce0230ca |
|
MD5 | f465866df04f56113919dcd9d1ffa0ee |
|
BLAKE2b-256 | 13032edb56253a2ffe0dc6ae85605a737a3403cea3ddc98caed38aff9711f05c |