Metadata-Version: 2.1
Name: conventional-commits-check
Version: 1.0.0
Summary: A pre-commit hook to check Conventional Commits and add emojis.
Home-page: https://github.com/AliYmn/conventional-commits-check
Author: Ali Yaman
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.0
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Description-Content-Type: text/markdown
License-File: LICENSE

# Conventional Commits Check

<center><img src="images/result.png"></center>

`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 🎉

```json
{
    "feat": "✨",
    "fix": "🐛",
    "docs": "📚",
    "style": "💎",
    "refactor": "🧹",
    "perf": "🚀",
    "test": "🧪",
    "build": "🏗️",
    "ci": "👷",
    "chore": "♻️",
    "revert": "⏪",
}
```

# Customization

```bash
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:

```yaml
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:

1. 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:

```yaml
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]
```

2. Update the pre-commit hooks in your project:


```bash
pre-commit install --hook-type commit-msg -f
```

3. Install the conventional-commits-check package:


```bash
pip install conventional-commits-check
```

4. You may need to update the pre-commit package;

```bash
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.

