Skip to main content

Python Conventional Commit Checker

Project description

The Python Conventional Commit Checker.

What is pccc?

pccc is a PyParsing based grammar and script for parsing and verifying a commit message is a conventional commit. The default grammar follows the specification, but allows for the definition of types in addition to feat and fix and for the definition of project specific scopes and footers in compliance with the specification. The maximum line lengths of the commit header and commit body and spelling can also be checked.

Currently, the script interface will load configuration options and a commit message and attempt to parse it. If there are no parse exceptions, it will return 0, otherwise 1. This interface should be usable at the git commit-msg hook stage now.

Roadmap

  1. 100% test coverage, with tests implemented before merging. (target: 0.4.0)

  2. Complete documentation integration and upload. (target: 0.4.0)

  3. Integrate argparse help into documentation. (target: 0.4.0)

  4. Insert license information into all source files. (target: 0.4.0)

  5. Complete upload and build for setuptools/pip and poetry. (target: 0.4.0)

  6. Github issue template based off current tests/good/*.json files, with guidelines. (target: 0.4.0)

  7. Finish body wrapping. (target: 0.5.0)

    • fail if over

    • rewrap if over

    • do nothing if fine

    • rewrap if fine

  8. Implement spell checking. (target: 0.6.0)

    • will not autocorrect

    • communication: kick back to editor on errors, with comment line to indicate acceptance

  9. Implement simple reformatting. (target: 0.7.0)

    • footer separator as “: “ and not “ #”

    • “BREAKING-CHANGE” not “BREAKING CHANGE”

    • set breaking flag (!) and “BREAKING-CHANGE”

    • correct token capitalization (“BREAKING-CHANGE” not “breaking-change” or “Breaking-Change”; “Signed-off-by” not “Signed-Off-By” or “signed-off-by”)

  10. Implement partial parsing on failure for correction and improved exception handling. (target: 0.9.0 or later)

    • header partial parsing

    • body partial parsing

    • breaking change partial parsing

    • footer partial parsing

  11. Implement custom hooks for handling per-project footers. (target: 0.9.0 or later)

Installation

Install pccc with:

pip install pccc

or add as a poetry dev-dependency (TODO).

Usage

Console:

pccc COMMIT_MSG
cat COMMIT_MSG | pccc

In Python:

>>> import pccc
>>> ccr = pccc.ConventionalCommitRunner()
>>> ccr.options.load()
>>> ccr.raw = "some commit message"
>>> ccr.clean()
>>> ccr.parse()
>>> if ccr.exc == None:
...     print(ccr)

See the source and documentation for more information.

Configuration

See pccc.toml for an example [tool.pccc] section that may be copied into a pyproject.toml file.

Author

Jeremy A Gray

Project details


Download files

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

Source Distribution

pccc-0.3.2.tar.gz (249.6 kB view hashes)

Uploaded Source

Built Distribution

pccc-0.3.2-py3-none-any.whl (22.5 kB view hashes)

Uploaded Python 3

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