Skip to main content

Check commit message formatting, branch naming, commit author, email, and more.

Project description

PyPI CI Quality Gate Status pre-commit.ci status CodeCov

Overview

Check commit message formatting, branch naming, committer name, email, and more. The open-source alternative to Yet Another Commit Checker.

  • requiring commit message to match regex

  • requiring branch naming to match regex

  • requiring committer name and email to match regex

  • customizing error message

  • customizing suggest command

Purpose

commit-check is a tool designed for teams.

Its main purpose is to standardize the format of commit message, branch naming, etc, and makes it possible to:

  • writing descriptive commit is easy to read

  • identify branch according to the branch type

  • triggering the specific types of commit/branch CI build

  • automatically generate changelogs

Configuration

Use custom configuration

Create a config file .commit-check.yml under your repository root directory, e.g. .commit-check.yml

Use default configuration

Usage

There are a variety of ways you can use commit-check as follows.

Running as GitHub Action

Please see commit-check/commit-check-action

Running as pre-commit hook

-   repo: https://github.com/commit-check/commit-check
    rev: the tag or revision
    hooks:
    -   id: check-message
    -   id: check-branch

Running as CLI

Global installation

sudo pip3 install -U commit-check

User installation

pip install -U commit-check

Install from git repo

pip install git+https://github.com/commit-check/commit-check.git@main

Then you can run commit-check command line. More about commit-check --help please see docs.

Example

Check commit message failed

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 ||
 _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._
(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)(.-./`-´\.-.)
 `-´     `-´  `-´     `-´  `-´     `-´  `-´     `-´  `-´     `-´

Invalid commit message => test
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:

<type>[optional scope]: <description>
[optional body]
[optional footer(s)]

More details please refer to https://www.conventionalcommits.org
Suggest to run => git commit --amend

Check branch naming failed

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.

Invalid branch name => test
It doesn't match regex: ^(bugfix|feature|release|hotfix|task)\/.+|(master)|(main)|(HEAD)|(PR-.+)

Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/
Suggest to run => git checkout -b type/branch_name

Versioning

Versioning follows Semantic Versioning.

Have question or feedback?

To provide feedback (requesting a feature or reporting a bug) please post to issues.

License

The scripts and documentation in this project are released under the MIT License

If my open source projects are useful for your product/company you can also sponsor my work on them ☕

ko-fi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

commit_check-0.3.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file commit_check-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for commit_check-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c68943c12380daa75d42b4b3fb85625750b9d122f0c57740bb1f4469364b673d
MD5 df7a1a6b74a09af5d5176df657069a40
BLAKE2b-256 a3e9360cb678a682b5ebcb4014641f55fc0ac0ab7b0d9f077cf3c51f2b7cbb0d

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page