Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
8f1b0a5
feat(format): added scopes argument to specify valid scopes
mjspeck Jul 2, 2024
71bfc2a
refactor: cleaned up duplicate code in r_scope
mjspeck Jul 2, 2024
f51f662
chore: added additional delimeters for scope
mjspeck Jul 7, 2024
22d377a
fix: fixed scopes option by making it a flag
mjspeck Jul 7, 2024
95b5e45
chore: reorder scopes arg
thekaveman Jul 12, 2024
3b6ff05
docs: update with new --scope flag
thekaveman Jul 12, 2024
23e7888
Feat: added scopes argument to specify valid scopes (#102)
thekaveman Jul 12, 2024
f986b2f
feat(format): improve verbose commit message stripping
kmoschcau Jul 22, 2024
aaa3b7e
chore(pre-commit): autofix run
pre-commit-ci[bot] Jul 22, 2024
e32dbbd
feat(format): simplify verbose commit ignore regex
kmoschcau Jul 23, 2024
28dbfe5
feat(test): protect verbose commit message spaces
kmoschcau Jul 23, 2024
800b147
docs(format): improve doc strings for verbose commit messages
kmoschcau Jul 23, 2024
406f0d1
feat(format): improve verbose commit message stripping (#105)
thekaveman Aug 2, 2024
cb6a7f3
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Aug 5, 2024
81a658d
chore(pre-commit): autoupdate hooks (#107)
thekaveman Aug 9, 2024
132dbd7
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Sep 23, 2024
bdc549c
chore(pre-commit): autoupdate hooks (#112)
thekaveman Sep 25, 2024
8dea10c
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Oct 7, 2024
88f9fd3
chore(pre-commit): autoupdate hooks (#114)
thekaveman Oct 8, 2024
30a0c77
fix: optional scope not respected when --scope flag is used
nimaps Oct 15, 2024
3268646
chore(pre-commit): autofix run
pre-commit-ci[bot] Oct 15, 2024
085dcb3
Fix optional scope not respected when using --scopes flag (#113)
thekaveman Oct 15, 2024
1264bca
chore(ci): GitHub release after PyPI release
thekaveman Oct 15, 2024
50c461e
Chore: GitHub release after PyPI release (#115)
thekaveman Oct 15, 2024
0f77fdc
feat: Give a hint on how to reedit the commit message
maringuu Oct 16, 2024
95565c2
feat(output): module to produce CLI messages
thekaveman Oct 16, 2024
beb5c03
refactor(hook): get output from helper functions
thekaveman Oct 16, 2024
174d446
feat(hook): arg for more verbose output
thekaveman Oct 16, 2024
26392d2
refactor(format): extract regex construction and usage
thekaveman Oct 16, 2024
7c3a814
feat(output): verbose indicates specific errors
thekaveman Oct 16, 2024
f2c0be1
chore: make local config verbose
thekaveman Oct 16, 2024
6d66cf1
feat(output): color is optional, on by default
thekaveman Oct 17, 2024
367e740
feat(hook): arg to turn off color in output
thekaveman Oct 17, 2024
dd0ce28
docs: update README with new args, output
thekaveman Oct 16, 2024
fab6a95
Feat: improve output (#117)
thekaveman Oct 17, 2024
e8cc8c0
feat: option to skip merge commits format check
zlodes Jul 13, 2024
5a1a29b
feat: show allowed types
Olen Oct 31, 2024
675bd2a
refactor(devcontainer): move compose file to root
thekaveman Oct 21, 2024
de11cef
refactor(format): classes encapsulate logic
thekaveman Oct 18, 2024
f15423c
fix(hook): skip checking merge commits unless strict
thekaveman Oct 18, 2024
a918407
chore(format): case-insensitive merge commit check
thekaveman Oct 21, 2024
d14ec45
docs: update usage
thekaveman Oct 21, 2024
4684800
docs: note about default_install_hook_types
thekaveman Oct 21, 2024
f9a53ee
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Dec 2, 2024
3f1bb61
chore(pre-commit): autoupdate hooks (#123)
angela-tran Dec 5, 2024
5f9c312
Refactor: classes for format checking (#119)
thekaveman Dec 20, 2024
9b3ea98
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Jan 13, 2025
15290ae
chore(pre-commit): autoupdate hooks (#126)
angela-tran Jan 24, 2025
7d271fb
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Feb 17, 2025
ceb71ee
chore(pre-commit): autoupdate hooks (#128)
thekaveman Feb 22, 2025
e8a7632
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Mar 31, 2025
33500e9
chore(pre-commit): autoupdate hooks (#131)
angela-tran Mar 31, 2025
347f0ed
fix: skip merge commits patterns
bagowix Apr 29, 2025
fa1915d
fix: skip merge commits patterns (#134)
thekaveman Apr 29, 2025
669cd46
test: add validity tests for uppercase types
jonathanraesch May 3, 2025
9d18c1c
test: add validity test for uppercase scopes
jonathanraesch May 3, 2025
039089d
fix: make types and scopes case-insensitive
jonathanraesch May 3, 2025
37b5f04
fix: make types and scopes case-insensitive (#135)
thekaveman May 5, 2025
3954f14
chore(deps): bump actions/checkout from 4 to 5
dependabot[bot] Aug 12, 2025
4946744
chore(deps): bump actions/setup-python from 5 to 6
dependabot[bot] Sep 4, 2025
2cd9294
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Oct 6, 2025
10d1e31
fix: scope now allows usage of dots
ddluke Oct 8, 2025
b12adac
refactor: only specify scope delimiters once
ddluke Oct 9, 2025
5d2940c
fix: scope now allows usage of dots (#140)
thekaveman Oct 10, 2025
34d487a
chore(deps): bump actions/setup-python from 5 to 6 (#138)
thekaveman Oct 10, 2025
6e03c3c
chore(deps): bump actions/checkout from 4 to 5 (#137)
thekaveman Oct 10, 2025
5c3f3c6
chore(pre-commit): autoupdate hooks (#136)
thekaveman Oct 10, 2025
98b43bf
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Nov 17, 2025
fdde5f0
chore(pre-commit): autoupdate hooks (#141)
thekaveman Nov 21, 2025
2ef4033
chore(deps): bump actions/checkout from 5 to 6
dependabot[bot] Nov 21, 2025
980e24d
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Jan 19, 2026
e20efe8
chore(pre-commit): autofix run
pre-commit-ci[bot] Jan 19, 2026
aed2b93
feat: allow # in scope
aeyoll Feb 18, 2026
800557d
feat: allow # in scope (#148)
thekaveman Feb 18, 2026
d397bc7
chore(pre-commit): autoupdate hooks (#144)
thekaveman Feb 18, 2026
91ab4bf
chore(deps): bump actions/checkout from 5 to 6 (#143)
thekaveman Feb 18, 2026
255a6ec
chore(pre-commit): autoupdate hooks
pre-commit-ci[bot] Mar 16, 2026
bce2f33
chore(pre-commit): autoupdate hooks (#149)
thekaveman Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "compilerla/conventional-pre-commit",
"dockerComposeFile": ["./compose.yml"],
"dockerComposeFile": ["../compose.yml"],
"service": "dev",
"runServices": ["dev"],
"workspaceFolder": "/home/compiler/src",
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
Expand All @@ -36,16 +36,6 @@ jobs:
- name: Build package
run: python -m build

- name: Release
id: release
uses: softprops/action-gh-release@v2
with:
files: |
./dist/*.whl
./dist/*.tar.gz
prerelease: ${{ contains(github.ref, '-pre') }}
generate_release_notes: ${{ !contains(github.ref, '-pre') }}

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ contains(github.ref, '-pre') }}
Expand All @@ -60,3 +50,13 @@ jobs:
if: ${{ !contains(github.ref, '-pre') }}
with:
print-hash: true

- name: Release
id: release
uses: softprops/action-gh-release@v2
with:
files: |
./dist/*.whl
./dist/*.tar.gz
prerelease: ${{ contains(github.ref, '-pre') }}
generate_release_notes: ${{ !contains(github.ref, '-pre') }}
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default_install_hook_types:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
Expand All @@ -17,22 +17,22 @@ repos:
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 24.4.2
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.3.1
hooks:
- id: black
types:
- python

- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
rev: 7.3.0
hooks:
- id: flake8
types:
- python

- repo: https://github.com/pycqa/bandit
rev: 1.7.9
rev: 1.9.4
hooks:
- id: bandit
args: ["-ll"]
Expand All @@ -51,3 +51,4 @@ repos:
entry: conventional-pre-commit
language: python
stages: [commit-msg]
args: [--verbose]
59 changes: 37 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ Create a blank configuration file at the root of your repo, if needed:
touch .pre-commit-config.yaml
```

Add a new repo entry to your configuration file:
Add/update `default_install_hook_types` and add a new repo entry in your configuration file:

```yaml
default_install_hook_types:
- pre-commit
- commit-msg

repos:
# - repo: ...

Expand All @@ -32,7 +36,7 @@ repos:
Install the `pre-commit` script:

```console
pre-commit install --hook-type commit-msg
pre-commit install --install-hooks
```

Make a (normal) commit :x::
Expand All @@ -46,33 +50,41 @@ Conventional Commit......................................................Failed
- duration: 0.07s
- exit code: 1

[Bad Commit message] >> add a new feature

[Bad commit message] >> add a new feature
Your commit message does not follow Conventional Commits formatting
https://www.conventionalcommits.org/
```

Conventional Commits start with one of the below types, followed by a colon,
followed by the commit message:
And with the `--verbose` arg:

build chore ci docs feat fix perf refactor revert style test
```console
$ git commit -m "add a new feature"

Example commit message adding a feature:
[INFO] Initializing environment for ....
Conventional Commit......................................................Failed
- hook id: conventional-pre-commit
- duration: 0.07s
- exit code: 1

[Bad commit message] >> add a new feature
Your commit message does not follow Conventional Commits formatting
https://www.conventionalcommits.org/

feat: implement new API
Conventional Commit messages follow a pattern like:

Example commit message fixing an issue:
type(scope): subject

fix: remove infinite loop
extended body

Example commit with scope in parentheses after the type for more context:
Please correct the following errors:

fix(account): remove infinite loop
- Expected value for type from: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test

Example commit with a body:
Run:

fix: remove infinite loop
git commit --edit --file=.git/COMMIT_EDITMSG

Additional information on the issue caused by the infinite loop
to edit the commit message and retry the commit.
```

Make a (conventional) commit :heavy_check_mark::
Expand Down Expand Up @@ -129,18 +141,21 @@ print(is_conventional("custom: this is a conventional commit", types=["custom"])

```shell
$ conventional-pre-commit -h
usage: conventional-pre-commit [-h] [--force-scope] [--strict] [types ...] input
usage: conventional-pre-commit [-h] [--no-color] [--force-scope] [--scopes SCOPES] [--strict] [--verbose] [types ...] input

Check a git commit message for Conventional Commits formatting.

positional arguments:
types Optional list of types to support
input A file containing a git commit message
types Optional list of types to support
input A file containing a git commit message

options:
-h, --help show this help message and exit
--force-scope Force commit to have scope defined.
--strict Force commit to strictly follow Conventional Commits formatting. Disallows fixup! style commits.
-h, --help show this help message and exit
--no-color Disable color in output.
--force-scope Force commit to have scope defined.
--scopes SCOPES List of scopes to support. Scopes should be separated by commas with no spaces (e.g. api,client).
--strict Force commit to strictly follow Conventional Commits formatting. Disallows fixup! and merge commits.
--verbose Print more verbose error output.
```

Supply arguments on the command-line, or via the pre-commit `hooks.args` property:
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/compose.yml → compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
services:
dev:
build:
context: ..
context: .
dockerfile: .devcontainer/Dockerfile
entrypoint: []
command: sleep infinity
image: compilerla/conventional-pre-commit:dev
volumes:
- ../:/home/compiler/src
- ./:/home/compiler/src
Loading