Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/commit-check/commit-check
Commit Check enforces commit metadata standards, including commit message, branch naming, committer name/email, commit signoff and more.
https://github.com/commit-check/commit-check
branch-naming commit-check conventional-branch conventional-commits
Last synced: about 2 months ago
JSON representation
Commit Check enforces commit metadata standards, including commit message, branch naming, committer name/email, commit signoff and more.
- Host: GitHub
- URL: https://github.com/commit-check/commit-check
- Owner: commit-check
- License: mit
- Created: 2022-04-25T13:41:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T13:03:36.000Z (3 months ago)
- Last Synced: 2024-10-29T15:21:08.195Z (3 months ago)
- Topics: branch-naming, commit-check, conventional-branch, conventional-commits
- Language: Python
- Homepage: https://pypi.org/project/commit-check
- Size: 33.5 MB
- Stars: 9
- Watchers: 1
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- awesome-python-testing - commit-check - Check commit message formatting, branch naming, commit author, email, and more. (Resources / Related)
README
Commit Check
============.. |pypi-version| image:: https://img.shields.io/pypi/v/commit-check?logo=python&logoColor=white
:target: https://pypi.org/project/commit-check/
:alt: PyPI.. |ci-badge| image:: https://github.com/commit-check/commit-check/actions/workflows/main.yml/badge.svg
:target: https://github.com/commit-check/commit-check/actions/workflows/main.yml
:alt: CI.. |sonar-badge| image:: https://sonarcloud.io/api/project_badges/measure?project=commit-check_commit-check&metric=alert_status
:target: https://sonarcloud.io/summary/new_code?id=commit-check_commit-check
:alt: Quality Gate Status.. |codecov-badge| image:: https://codecov.io/gh/commit-check/commit-check/branch/main/graph/badge.svg?token=GC2U5V5ZRT
:target: https://codecov.io/gh/commit-check/commit-check
:alt: CodeCov.. |commit-check-badge| image:: https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white
:target: https://github.com/commit-check/commit-check
:alt: commit-check.. |slsa-badge| image:: https://slsa.dev/images/gh-badge-level3.svg
:target: https://slsa.dev
:alt: SLSA|pypi-version| |ci-badge| |sonar-badge| |codecov-badge| |commit-check-badge| |slsa-badge|
Overview
--------**Commit Check** is a free, powerful tool that enforces commit metadata standards, including commit message, branch naming, committer name/email, and commit signoff. Fully customizable with error messages and suggested commands, it ensures compliance across teams.
As an alternative to GitHub Enterprise `Metadata restrictions `_ and Bitbucket's paid puglin `Yet Another Commit Checker `_, Commit Check stands out by integrating DevOps principles and Infrastructure as Code (IaC).
Configuration
-------------Use Default Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~- If you don't set ``.commit-check.yml``, Commit Check will use the `default configuration `_.
- The commit message will follow the rules of `Conventional Commits `_,
branch naming follow the rules of `Conventional Branch `_.Use Custom Configuration
~~~~~~~~~~~~~~~~~~~~~~~~Create a config file ``.commit-check.yml`` under your repository's root directory, e.g., `.commit-check.yml `_
Usage
-----Running as GitHub Action
~~~~~~~~~~~~~~~~~~~~~~~~Please see `commit-check/commit-check-action `_
Running as pre-commit hook
~~~~~~~~~~~~~~~~~~~~~~~~~~.. tip::
Make sure ``pre-commit`` is `installed `_.
.. code-block:: yaml
- repo: https://github.com/commit-check/commit-check
rev: the tag or revision
hooks: # support hooks
- id: check-message # requires hook prepare-commit-msg
- id: check-branch
- id: check-author-name
- id: check-author-email
- id: check-commit-signoff
- id: check-merge-base # requires download all git historyRunning as CLI
~~~~~~~~~~~~~~Global Installation
.. code-block:: bash
sudo pip3 install -U commit-check
User Installation
.. code-block:: bash
pip install -U commit-check
Install from Git Repo
.. code-block:: bash
pip install git+https://github.com/commit-check/commit-check.git@main
Then, run ``commit-check`` from the command line. For more information, see the `docs `_.
Running as Git Hooks
~~~~~~~~~~~~~~~~~~~~To configure the hook, create a script file in the ``.git/hooks/`` directory.
.. code-block:: bash
#!/bin/sh
commit-check --message --branch --author-name --author-email --commit-signoff --merge-baseSave the script file as ``pre-push`` and make it executable:
.. code-block:: bash
chmod +x .git/hooks/pre-push
Now, ``git push`` will trigger this hook automatically.
Example
-------Check Commit Message Failed
.. code-block:: text
Commit rejected by Commit-Check.
(c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
/ ._. \ / ._. \ / ._. \ / ._. \ / ._. \
__\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
|| E || || R || || R || || O || || R ||
_.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
`-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´Type message check failed => my test commit message
It doesn't match regex: ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)The commit message should be structured as follows:
[optional scope]:
[optional body]
[optional footer(s)]More details please refer to https://www.conventionalcommits.org
Suggest: please check your commit message whether matches above regexCheck Branch Naming Failed
.. code-block:: text
Commit rejected by Commit-Check.
(c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c)
/ ._. \ / ._. \ / ._. \ / ._. \ / ._. \
__\( C )/__ __\( H )/__ __\( E )/__ __\( C )/__ __\( K )/__
(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)
|| E || || R || || R || || O || || R ||
_.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._ _.' '-' '._
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
`-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´ `-´Commit rejected.
Type branch check failed => my-test-branch
It doesn't match regex: ^(bugfix|feature|release|hotfix|task|chore)\/.+|(master)|(main)|(HEAD)|(PR-.+)Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/ chore/
Suggest: run command `git checkout -b type/branch_name`Badging your repository
-----------------------You can add a badge to your repository to show that you use commit-check!
.. image:: https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white
:target: https://github.com/commit-check/commit-check
:alt: commit-checkMarkdown
.. code-block:: text
[![commit-check](https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white)](https://github.com/commit-check/commit-check)
reStructuredText
.. code-block:: text
.. image:: https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white
:target: https://github.com/commit-check/commit-check
:alt: commit-checkVersioning
----------Versioning follows `Semantic Versioning `_.
Have question or feedback?
--------------------------Please post to `issues `_ for feedback, feature requests, or bug reports.
License
-------This project is released under the `MIT License `_