Skip to main content

Basic commit checker, with optional emoji check

Project description

Code style: black Travis (.com) branch 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.

Files for py-commit-checker, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size py_commit_checker-0.3.0-py2.py3-none-any.whl (6.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page