commit-check


Namecommit-check JSON
Version 0.7.4 PyPI version JSON
download
home_pageNone
SummaryCheck commit message formatting, branch naming, commit author, email, and more.
upload_time2024-04-07 06:44:37
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseMIT License
keywords commit conventions conventional commits branch naming commit-check message lint message
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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 supports checking commit messages, branch naming, committer name/email, commit signoff, customizing error messages, suggested commands and more.

It is a powerful, free solution for individuals and teams aiming to standardize commit message formatting and branch naming, including

- 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

If you're using Bitbucket, it's an open source alternative to `Yet Another Commit Checker <https://marketplace.atlassian.com/apps/1211854/yet-another-commit-checker?tab=overview&hosting=datacenter>`_.

Configuration
-------------

Use Custom Configuration
~~~~~~~~~~~~~~~~~~~~~~~~

Create a config file ``.commit-check.yml`` under your repository's root directory, e.g., `.commit-check.yml <https://github.com/commit-check/commit-check/blob/main/.commit-check.yml>`_

Use Default Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~

- If you don't set ``.commit-check.yml``, Commit Check will use the `default configuration <https://github.com/commit-check/commit-check/blob/main/commit_check/__init__.py>`_.

- The commit message will follow the rules of `conventional commits <https://www.conventionalcommits.org/en/v1.0.0/#summary>`_,
  branch naming follow Bitbucket's `branching model <https://support.atlassian.com/bitbucket-cloud/docs/configure-a-projects-branching-model/>`_.


Usage
-----

Running as GitHub Action
~~~~~~~~~~~~~~~~~~~~~~~~

Please see `commit-check/commit-check-action <https://github.com/commit-check/commit-check-action>`_

Running as pre-commit hook
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. tip::

    Make sure ``pre-commit`` is `installed <https://pre-commit.com/#install>`_.

.. code-block:: yaml

    -   repo: https://github.com/commit-check/commit-check
        rev: the tag or revision
        hooks: # support hooks
        -   id: check-message  # it requires hook prepare-commit-msg
        -   id: check-branch
        -   id: check-author-name
        -   id: check-author-email
        -   id: check-commit-signoff

Running 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 <https://commit-check.github.io/commit-check/cli_args.html>`_.

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

Save 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:

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

    More details please refer to https://www.conventionalcommits.org
    Suggest: please check your commit message whether matches above regex


Check 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)\/.+|(master)|(main)|(HEAD)|(PR-.+)

    Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/
    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-check

Markdown

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


Versioning
----------

Versioning follows `Semantic Versioning <https://semver.org/>`_.

Have question or feedback?
--------------------------

Please post to `issues <https://github.com/commit-check/commit-check/issues>`_ for feedback, feature requests, or bug reports.

License
-------

This project is released under the `MIT License <https://github.com/commit-check/commit-check/blob/main/LICENSE>`_

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "commit-check",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "commit conventions, conventional commits, branch naming, commit-check, message, lint message",
    "author": null,
    "author_email": "Peter Shen <xianpeng.shen@gmail.com>",
    "download_url": null,
    "platform": null,
    "description": "Commit Check\n============\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/commit-check?logo=python&logoColor=white\n    :target: https://pypi.org/project/commit-check/\n    :alt: PyPI\n\n.. |ci-badge| image:: https://github.com/commit-check/commit-check/actions/workflows/main.yml/badge.svg\n    :target: https://github.com/commit-check/commit-check/actions/workflows/main.yml\n    :alt: CI\n\n.. |sonar-badge| image:: https://sonarcloud.io/api/project_badges/measure?project=commit-check_commit-check&metric=alert_status\n    :target: https://sonarcloud.io/summary/new_code?id=commit-check_commit-check\n    :alt: Quality Gate Status\n\n.. |codecov-badge| image:: https://codecov.io/gh/commit-check/commit-check/branch/main/graph/badge.svg?token=GC2U5V5ZRT\n    :target: https://codecov.io/gh/commit-check/commit-check\n    :alt: CodeCov\n\n.. |commit-check-badge| image:: https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white\n    :target: https://github.com/commit-check/commit-check\n    :alt: commit-check\n\n.. |slsa-badge| image:: https://slsa.dev/images/gh-badge-level3.svg\n    :target: https://slsa.dev\n    :alt: SLSA\n\n|pypi-version| |ci-badge| |sonar-badge| |codecov-badge| |commit-check-badge| |slsa-badge|\n\nOverview\n--------\n\nCommit Check supports checking commit messages, branch naming, committer name/email, commit signoff, customizing error messages, suggested commands and more.\n\nIt is a powerful, free solution for individuals and teams aiming to standardize commit message formatting and branch naming, including\n\n- writing descriptive commit is easy to read\n- identify branch according to the branch type\n- triggering the specific types of commit/branch CI build\n- automatically generate changelogs\n\nIf you're using Bitbucket, it's an open source alternative to `Yet Another Commit Checker <https://marketplace.atlassian.com/apps/1211854/yet-another-commit-checker?tab=overview&hosting=datacenter>`_.\n\nConfiguration\n-------------\n\nUse Custom Configuration\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nCreate a config file ``.commit-check.yml`` under your repository's root directory, e.g., `.commit-check.yml <https://github.com/commit-check/commit-check/blob/main/.commit-check.yml>`_\n\nUse Default Configuration\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- If you don't set ``.commit-check.yml``, Commit Check will use the `default configuration <https://github.com/commit-check/commit-check/blob/main/commit_check/__init__.py>`_.\n\n- The commit message will follow the rules of `conventional commits <https://www.conventionalcommits.org/en/v1.0.0/#summary>`_,\n  branch naming follow Bitbucket's `branching model <https://support.atlassian.com/bitbucket-cloud/docs/configure-a-projects-branching-model/>`_.\n\n\nUsage\n-----\n\nRunning as GitHub Action\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nPlease see `commit-check/commit-check-action <https://github.com/commit-check/commit-check-action>`_\n\nRunning as pre-commit hook\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. tip::\n\n    Make sure ``pre-commit`` is `installed <https://pre-commit.com/#install>`_.\n\n.. code-block:: yaml\n\n    -   repo: https://github.com/commit-check/commit-check\n        rev: the tag or revision\n        hooks: # support hooks\n        -   id: check-message  # it requires hook prepare-commit-msg\n        -   id: check-branch\n        -   id: check-author-name\n        -   id: check-author-email\n        -   id: check-commit-signoff\n\nRunning as CLI\n~~~~~~~~~~~~~~\n\nGlobal Installation\n\n.. code-block:: bash\n\n    sudo pip3 install -U commit-check\n\nUser Installation\n\n.. code-block:: bash\n\n    pip install -U commit-check\n\nInstall from Git Repo\n\n.. code-block:: bash\n\n    pip install git+https://github.com/commit-check/commit-check.git@main\n\nThen, run ``commit-check`` from the command line. For more information, see the `docs <https://commit-check.github.io/commit-check/cli_args.html>`_.\n\nRunning as Git Hooks\n~~~~~~~~~~~~~~~~~~~~\n\nTo configure the hook, create a script file in the ``.git/hooks/`` directory.\n\n.. code-block:: bash\n\n    #!/bin/sh\n    commit-check --message --branch --author-name --author-email\n\nSave the script file as ``pre-push`` and make it executable:\n\n.. code-block:: bash\n\n    chmod +x .git/hooks/pre-push\n\nNow, ``git push`` will trigger this hook automatically.\n\nExample\n-------\n\nCheck Commit Message Failed\n\n.. code-block:: text\n\n    Commit rejected by Commit-Check.\n\n      (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)\n       / ._. \\      / ._. \\      / ._. \\      / ._. \\      / ._. \\\n     __\\( C )/__  __\\( H )/__  __\\( E )/__  __\\( C )/__  __\\( K )/__\n    (_.-/'-'\\-._)(_.-/'-'\\-._)(_.-/'-'\\-._)(_.-/'-'\\-._)(_.-/'-'\\-._)\n       || E ||      || R ||      || R ||      || O ||      || R ||\n     _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._\n    (.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)\n     `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4\n\n    Type message check failed => my test commit message\n    It doesn't match regex: ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)\n\n    The commit message should be structured as follows:\n\n    <type>[optional scope]: <description>\n    [optional body]\n    [optional footer(s)]\n\n    More details please refer to https://www.conventionalcommits.org\n    Suggest: please check your commit message whether matches above regex\n\n\nCheck Branch Naming Failed\n\n.. code-block:: text\n\n    Commit rejected by Commit-Check.\n\n      (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)    (c).-.(c)\n       / ._. \\      / ._. \\      / ._. \\      / ._. \\      / ._. \\\n     __\\( C )/__  __\\( H )/__  __\\( E )/__  __\\( C )/__  __\\( K )/__\n    (_.-/'-'\\-._)(_.-/'-'\\-._)(_.-/'-'\\-._)(_.-/'-'\\-._)(_.-/'-'\\-._)\n       || E ||      || R ||      || R ||      || O ||      || R ||\n     _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._  _.' '-' '._\n    (.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)(.-./`-\u00b4\\.-.)\n     `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4  `-\u00b4     `-\u00b4\n\n    Commit rejected.\n\n    Type branch check failed => my-test-branch\n    It doesn't match regex: ^(bugfix|feature|release|hotfix|task)\\/.+|(master)|(main)|(HEAD)|(PR-.+)\n\n    Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/\n    Suggest: run command `git checkout -b type/branch_name`\n\n\nBadging your repository\n-----------------------\n\nYou can add a badge to your repository to show that you use commit-check!\n\n.. image:: https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white\n    :target: https://github.com/commit-check/commit-check\n    :alt: commit-check\n\nMarkdown\n\n.. code-block:: text\n\n    [![commit-check](https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white)](https://github.com/commit-check/commit-check)\n\nreStructuredText\n\n.. code-block:: text\n\n    .. image:: https://img.shields.io/badge/commit--check-enabled-brightgreen?logo=Git&logoColor=white\n        :target: https://github.com/commit-check/commit-check\n        :alt: commit-check\n\n\nVersioning\n----------\n\nVersioning follows `Semantic Versioning <https://semver.org/>`_.\n\nHave question or feedback?\n--------------------------\n\nPlease post to `issues <https://github.com/commit-check/commit-check/issues>`_ for feedback, feature requests, or bug reports.\n\nLicense\n-------\n\nThis project is released under the `MIT License <https://github.com/commit-check/commit-check/blob/main/LICENSE>`_\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Check commit message formatting, branch naming, commit author, email, and more.",
    "version": "0.7.4",
    "project_urls": {
        "source": "https://github.com/commit-check/commit-check",
        "tracker": "https://github.com/commit-check/commit-check/issues"
    },
    "split_keywords": [
        "commit conventions",
        " conventional commits",
        " branch naming",
        " commit-check",
        " message",
        " lint message"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bdb3f192fb0c40b0d682845ab8fcc5b0d81a67e43c9ddd9b9f6e73771a18bad",
                "md5": "91ae650dda501132cb653c5a93253f3c",
                "sha256": "f352412505de61ad2fdc9a9e674a601c82c20977d4e7cb30ec8c320cb873a7d7"
            },
            "downloads": -1,
            "filename": "commit_check-0.7.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "91ae650dda501132cb653c5a93253f3c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11452,
            "upload_time": "2024-04-07T06:44:37",
            "upload_time_iso_8601": "2024-04-07T06:44:37.476659Z",
            "url": "https://files.pythonhosted.org/packages/1b/db/3f192fb0c40b0d682845ab8fcc5b0d81a67e43c9ddd9b9f6e73771a18bad/commit_check-0.7.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-07 06:44:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "commit-check",
    "github_project": "commit-check",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "commit-check"
}
        
Elapsed time: 0.21337s