Skip to main content

Basic commit checker, with optional emoji check

Project description

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.

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

py_commit_checker-0.3.1-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file py_commit_checker-0.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: py_commit_checker-0.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for py_commit_checker-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c6e1b517fc24cc3d20a4d269b8aa86d08e58fe991bbab610e50fc4279929ec06
MD5 9d686ec81c2c76e132dfbfa80851d2c6
BLAKE2b-256 da4ca88ffff39fd5733082268cf8107eaa0dbf994b99750b00574a4a1ea880ca

See more details on using hashes here.

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