A collection of checks for the commit-msg for pre-commit.
Project description
A collection of checks for the commit-msg for pre-commit.
The hooks in this repository makes it possible to check for the rules defined by https://commit.style/.:
Commit message style guide for Git The first line of a commit message serves as a summary. When displayed on the web, it's often styled as a heading, and in emails, it's typically used as the subject. As such, you should capitalize it and omit any trailing punctuation. Aim for about 50 characters, give or take, otherwise it may be painfully truncated in some contexts. Write it, along with the rest of your message, in the imperative tense: "Fix bug" and not "Fixed bug" or "Fixes bug". Consistent wording makes it easier to mentally process a list of commits. Oftentimes a subject by itself is sufficient. When it's not, add a blank line (this is important) followed by one or more paragraphs hard wrapped to 72 characters. Git is strongly opinionated that the author is responsible for line breaks; if you omit them, command line tooling will show it as one extremely long unwrapped line. Fortunately, most text editors are capable of automating this. :q
And then some.
All hooks can be used from the command line as well.
Usage
Configure https://pre-commit.com for checking compliance with https://commit.style
repos:
- repo: ../pre-commit-commit-msg-hooks
rev: 0.1.0
hooks:
- id: check-description-max-length
- id: check-second-line-empty
- id: check-summary-capitalized
- id: check-summary-imperative
- id: check-summary-max-length
- id: check-summary-punctuation
Available Hooks
check-description-max-length
Check lines in the description are not more than 72 characters.
check-second-line-empty
Check the second line of the commit message is blank.
check-summary-conjunction
Check the summary does not contain conjugated sentences.
Searches for occurrences of ‘and’, ‘nor’, and ‘or’ and fails if found.
check-summary-imperative
Check the summary starts with a verb.
Searches a wordlist comprised of > 6000 verbs. The check fails if not found.
check-summary-capitalized
Check the summary starts with a capital letter.
check-summary-max-length
Check the summary is not more than 54 characters.
check-summary-min-length
Check the summary is at least 6 characters.
check-summary-punctuation
Check the summary does not end with punctuation.
Checks the last character against string.punctuation and fails on match.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pre-commit-commit-msg-hooks-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ae63ef5499eef77b1754df1e4fcf9fb847f6766c9d54d91406fa5b1cf9d1e63 |
|
MD5 | 2bf679c6a00f2076ac3dc12ea0b7c8bb |
|
BLAKE2b-256 | ad53680a88835c3c1ccf3d3d4b58c0507b0fcf171a52aa662d9e1629845d6b36 |
Hashes for pre_commit_commit_msg_hooks-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5bacea75019f3be1d4e3cc3d3b101de6a1d36204cabc104cd4117ddfc445c1a |
|
MD5 | 00f6b036edd84b5ac35cd165b2416b44 |
|
BLAKE2b-256 | 096ee5c1c008811f7889a93a7fd5b75b379a8b8fa4e91c3e9dfed32c1f7f3f1a |