Skip to main content

Code style: black GitHub Workflow Status PyPI version PyPI pyversions License: MIT

📝 py-commit-checker

A basic git commit message format checker.

Note: check out https://github.com/jorisroovers/gitlint for a much better, more featureful, and actually tested implementation! the only unique feature in py-commit-checker is the built in leading emoji check... 😀

Checkers

Small set of mandatory (cannot be disabled) and optional (opt in or out) checkers.

Always enabled

These checks are always enabled:

  1. mandatory blank second line (delimiting title + body of message)

Optional

These checks can be set to on or off using command line args:

  1. 50/72 rule checking (configurable lengths)
  2. leading emoji check

Returns non-zero in case of any violation

Install

pip install py-commit-checker
# note: you'll need git installed for the gitpython dependency to work!

Usage

# check top commit for 50/72 + emoji compliance on HEAD
py-commit-checker --emojis

# check a specific commit
py-commit-checker --emojis --commit HEAD~2

# check a repo at a path other than cwd
py-commit-checker --repo-path ../openbsd

# check a range of commits; py-commit-checker-branch helper script (installed
# alongside py-commit-checker)
PY_COMMIT_CHECKER_ARGS='--emojis' py-commit-checker-branch origin/master

Why is this not just a single regex

Because I was too lazy to figure out how to exclude URI elements from the body line length check in regex 🐸☕.

Also distributing with pypi is pretty convenient 😀

Tests

This package uses tox. To run the tests locally:

pip install tox==3.7.0  # minimum supported version

tox --parallel auto  # run tox in parallel

This is a py2+3 universal package; it's recommended you install python3.6 with whatever your system package manager is, if it isn't already installed, so tox can run the checks for that too.

Tox will enforce 100% pylint compliance, and black formatting compliance.

License

MIT.

Metadata

Release files for py-commit-checker 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for py-commit-checker 0.3.1
File Interpreter ABI Platform
py_commit_checker-0.3.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / py_commit_checker-0.3.1-py2.py3-none-any.whl

Download URL py_commit_checker-0.3.1-py2.py3-none-any.whl
Size 6.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c6e1b517fc24cc3d20a4d269b8aa86d08e58fe991bbab610e50fc4279929ec06
BLAKE2b-256 checksum
How to use checksums
da4ca88ffff39fd5733082268cf8107eaa0dbf994b99750b00574a4a1ea880ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

0.0.1

1 release file

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page