Skip to main content

🎉 Conventional Commits Check

PyPI Version License Last Commit Issues Stars Forks Downloads Contributors

Result Image

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! 🚀

📜 What are Conventional Commits?

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.

💡 Features

  • ✅ 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.
  • 🔄 Auto-Merge Commit Handling: Automatically formats auto-merge commit messages to follow a consistent style.

🔄 Auto-Merge Commit Handling

The conventional-commits-check tool includes functionality to handle auto-merge commit messages. When a commit message matches the pattern "Merge branch '...' into '...'", it is automatically reformatted to a more consistent style, such as "merge: branch '...' into '...'". If emojis are enabled, a 🎉 emoji is prepended to the message. This feature ensures that even auto-generated commit messages maintain a clean and readable format.

🔧 Customization

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 ...
}

Customizing Existing Emojis

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: 🛠️

⚙️ Installation

To add conventional-commits-check to your project, follow these steps:

  1. 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: v2.9.0  # Use the latest release version
        hooks:
          - id: conventional-commits-check
            stages: [commit-msg]
            args: ["--emoji-disabled"]  # Use this argument to disable emojis
    
  2. Install the pre-commit hook:

    pre-commit install --hook-type commit-msg -f
    
  3. Install the conventional-commits-check package:

    pip install -U conventional-commits-check
    
  4. Optional: Update the pre-commit package:

    pre-commit autoupdate
    

🚀 Usage

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.

👨‍💻 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests to enhance conventional-commits-check. Let’s make commits fun and consistent! 😄

📜 License

This project is licensed under the MIT License.


Enhance your workflow and bring some life to your commits with conventional-commits-check! 🎉✨🐛

Release files for conventional-commits-check 2.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for conventional-commits-check 2.9.0
File Size Uploaded
conventional_commits_check-2.9.0.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for conventional-commits-check 2.9.0
File Interpreter ABI Platform
conventional_commits_check-2.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.3 kB

Release files / conventional_commits_check-2.9.0.tar.gz

Download URL conventional_commits_check-2.9.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6b58af0c424994ae63102715936bfc3027edc9a17d2017c19a1753da9250790c
BLAKE2b-256 checksum
How to use checksums
a9e3805339509a69f9e48d698c1860b39498808d2f6980172154152b8a2219c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / conventional_commits_check-2.9.0-py3-none-any.whl

Download URL conventional_commits_check-2.9.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2864cb3f6d9c921d0c035c3c45254bcb8d4a70c50bc531ef515032dea6178dc
BLAKE2b-256 checksum
How to use checksums
d0ca9354317f115714f410d8c3fd9e2c9a6e85f5b24d4ff24bad6d305f5975f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

2.9.0 This release

2 release files

2.8.0

2 release files

2.3.0

2 release files

2.1.0

2 release files

2.0.0

1 release file

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page