conventional-commits-check
is a powerful and easy-to-use Python pre-commit hook that helps enforce Conventional Commits rules on your commit messages. It supports adding relevant emojis based on your commit types to enhance readability and bring some fun to your commit history! 🚀
Conventional Commits provide a lightweight convention for creating a clear and explicit commit history. By using this hook, you'll ensure that your commit messages follow this convention, making your versioning easier to manage and your collaboration more seamless.
- ✅ Enforces Conventional Commits rules on your commit messages.
- 🎨 Optionally adds context-specific emojis to the start of commit messages.
- 🛑 Blocks commits that do not conform to the Conventional Commits standard.
- 🔧 Allows for custom commit types and custom emojis via configuration.
You can customize the commit types and their associated emojis by modifying the commit_types.py
and commits_check_config.yaml
files. These files allow you to define additional commit types and specify emojis for each type.
Example : commit_types.py
commit_types = {
"access": {
"description": "Improve accessibility.",
"emoji": "♿️"
},
"analytics": {
"description": "Add or update analytics or track code.",
"emoji": "📈"
},
"animation": {
"description": "Add or update animations and transitions.",
"emoji": "💫"
},
"arch": {
"description": "Make architectural changes.",
"emoji": "🏗️"
},
"assets": {
"description": "Add or update assets.",
"emoji": "🍱"
},
"beer": {
"description": "Write code drunkenly.",
"emoji": "🍻"
},
# ... more commit types ...
}
You can also modify the emojis for existing commit types by updating the commits_check_config.yaml
:
additional_commit_types:
feat:
description: Introduce new features.
emoji: 🎉
fix:
description: Fix a bug.
emoji: 🛠️
To add conventional-commits-check
to your project, follow these steps:
-
Update your
.pre-commit-config.yaml
:In your project’s root directory, add the following:
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] args: ["--emoji-disabled"] # Use this argument to disable emojis
-
Install the pre-commit hook:
pre-commit install --hook-type commit-msg -f
-
Install the
conventional-commits-check
package:pip install -U conventional-commits-check
-
Optional: Update the pre-commit package:
pre-commit autoupdate
Once the hook is added, it will automatically run each time you make a commit. The hook checks your commit message against Conventional Commits rules, optionally adds the appropriate emoji, and prevents non-conforming commits.
Contributions are welcome! Feel free to open issues or submit pull requests to enhance conventional-commits-check
. Let’s make commits fun and consistent! 😄
This project is licensed under the MIT License.
Enhance your workflow and bring some life to your commits with conventional-commits-check
! 🎉✨🐛