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 hashes)

Uploaded Python 2 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