A tool to check git commit messages format
Project description
commit-format
A tool to check your commit messages format.
Supported checkers
Primarily disigned for to check for spelling mistakes in commit messages,
commit-format now comes with various checker allowing to:
- Check that each message lines does not exceed a length limit.
- Check for spelling mistake on commit messages.
NEWCheck commit header/body/footer against a defined template.
Installation
pip install commit-format
Help command will show you all availables options:
commit-format --help
Format options
-l, --limit Line limit check
You can check that every line in the commit message (including the title/header)
does not exceed a length limit. By default the value is set to 72.
A limit of '0' --limit 0 will disable the line limit checker.
Usage:
commit-format -l 80
URL in the commit body will not trigger any length warnings if it adheres to the expected format.
my commit message has a ref[1] ... [1] url://...
-ns, --no-spelling Disable spelling mistake
By default, commit-format checks for common spelling mistakes in the commit
messages. This option rely on codespell and may produce some false-positive
results. This new option -ns --no-spelling let the user disable the
spelling checker.
commit-format -ns
-t, --template Template compliance
You can provide a configuration TOML file template to validate the commit header/footer format and required symbols.
Usage:
commit-format -t /path/to/.commit-format
Template schema (TOML):
- [header]
- pattern: Regex that the first line (header) must match.
- [body]
- allow_empty: true/false to allow a commit with only a header (no body).
- blank_line_after_header: true/false to enforce a blank line between header and body.
- [footer]
- required: true/false to require a footer section.
- pattern: Regex that each footer line must match.
Example .commit-format:
[header]
# header line regex:
pattern = ^(feat: |fic: |ci: |doc: ).+$
[body]
# Allow empty body commit message. (i.e. single line commit message).
allow_empty = false
# Require that header line and body line are separated by an empty line.
blank_line_after_header = true
[footer]
# Require a footer line
required = true
# Footer line regex
pattern = ^(Signed-off-by: ).+$
Behavior option
-a, --all Force checking all commits
By default the script will only run on a branch and stop when reaching the base branch. If run on a base branch directly, the script will throw an error:
Running on branch main. Abort checking commits.
This measure is there to prevent running the script over past commits.
If running on 'main'/'master' is required, option -a will force the script
to run regadless the branch name.
Usage:
commit-format -a
-b, --base Base branch name
You can set the base branch name according to your project.
As described in option -a section the base branch name is required to let the
script restrict it's analysis on the commits of a branch. Default value for the
base branch name is main.
When running this script in a CI environment, you may be required to fetch your base branch manually. See github workflow example.
Usage:
commit-format -b origin/main
-v, --verbosity
Display debug messages from the script.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commit_format-0.2.3.tar.gz.
File metadata
- Download URL: commit_format-0.2.3.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2c7a4e54655dab15c36edca7d83a21b57c59d598fba095e7096b5611c806b3e
|
|
| MD5 |
7139ba5dc2f1850061211ce27a6e01ce
|
|
| BLAKE2b-256 |
106ee0185cf2b31b13f1804365ebd4c56db5f409edb45d351143fc92c8ae7874
|
Provenance
The following attestation bundles were made for commit_format-0.2.3.tar.gz:
Publisher:
release.yml on AlexFabre/commit-format
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commit_format-0.2.3.tar.gz -
Subject digest:
f2c7a4e54655dab15c36edca7d83a21b57c59d598fba095e7096b5611c806b3e - Sigstore transparency entry: 607813094
- Sigstore integration time:
-
Permalink:
AlexFabre/commit-format@4a08c60d252988bd2d5fff38f755657db9d8cad2 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/AlexFabre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a08c60d252988bd2d5fff38f755657db9d8cad2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file commit_format-0.2.3-py3-none-any.whl.
File metadata
- Download URL: commit_format-0.2.3-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4817b9a9b79075ce2df0996eaa80ffe6a55adeef30815568d4d542865beb56ca
|
|
| MD5 |
30f3f859954fc642bbf39f5f27047f33
|
|
| BLAKE2b-256 |
38e0ba61f8f6be1d921fde9ceac4346a86cb15e88c630cef5066174c229ee1a7
|
Provenance
The following attestation bundles were made for commit_format-0.2.3-py3-none-any.whl:
Publisher:
release.yml on AlexFabre/commit-format
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
commit_format-0.2.3-py3-none-any.whl -
Subject digest:
4817b9a9b79075ce2df0996eaa80ffe6a55adeef30815568d4d542865beb56ca - Sigstore transparency entry: 607813101
- Sigstore integration time:
-
Permalink:
AlexFabre/commit-format@4a08c60d252988bd2d5fff38f755657db9d8cad2 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/AlexFabre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4a08c60d252988bd2d5fff38f755657db9d8cad2 -
Trigger Event:
push
-
Statement type: