Open georgezavitsanos opened 1 week ago
Found a workaround with:
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [".git/COMMIT_EDITMSG"]
Hi @georgezavitsanos, can you please share the output of pre-commit -V
and the complete .pre-commit-config.yaml
you're using and/or a link to your repo if it is open source?
I'm not able to reproduce this. The commit message should be passed automatically via pre-commit
for the commit-msg
stage.
Hello!
My .pre-commit-config.yaml
repos:
- repo: https://github.com/ambv/black
rev: 24.10.0
hooks:
- id: black
language_version: python3.10
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: []
args: []
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.6.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [".git/COMMIT_EDITMSG", "--verbose"]
and pre-commit -V
:
pre-commit 4.0.1
Unfortunately, the repo is not open-source, so I cannot share it.
The above configuration works for me. Without ".git/COMMIT_EDITMSG"
in args list, it does not.
Thanks @georgezavitsanos. One more thought:
In our .pre-commit-config.yaml
files, we add this additional config at the top:
default_install_hook_types:
- pre-commit
- commit-msg
So that when we run pre-commit install --install-hooks
, hooks for these stages are installed by default. Otherwise, commit-msg
is not installed by default, see https://pre-commit.com/#top_level-default_install_hook_types.
This is probably related to #104 in that we need better docs here for the initial setup.
Can you try removing the .git/COMMIT_EDITMSG
arg, adding the above to your config file and reinstalling and/or try running
pre-commit install --hook-type commit-msg
, and see if it works for you?
Thanks for your reply. Unfortunately, it does not work. I get again
Conventional Commit......................................................Failed
- hook id: conventional-pre-commit
- exit code: 1
usage: conventional-pre-commit
[-h]
[--no-color]
[--force-scope]
[--scopes SCOPES]
[--strict]
[--verbose]
[types ...]
input
conventional-pre-commit: error: the following arguments are required: input
Anyway, I will use my work around. Thanks!
Hello, I have configured conventional-pre-commit from
.pre-commit-config.yaml file
,However, with
git commit -m "This is a comment"
. , I get,Please for your advise.