Closed
Description
Description
I installed the commitizen pre-commit hook along with some other pre-commit hooks:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
- id: ruff
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: local
hooks:
- id: export-requirements
name: export requirements from poetry
entry: bash -c 'cd "$(git rev-parse --show-toplevel)" && poetry export --without-hashes --format=requirements.txt > requirements.txt'
language: system
- repo: https://github.com/commitizen-tools/commitizen
rev: v1.17.0
hooks:
- id: commitizen
This config works fine in another project:
commitizen check.........................................................Failed
- hook id: commitizen
- exit code: 14
commit validation: failed!
please enter a commit message in the commitizen format.
commit: asfpaihsagf(semrel): Update semrel stuff in pyproject
pattern: (build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\(\S+\))?:\s.*
But when I run it in another project, it seems to include (arbitrary?) file paths in the cz
command:
commitizen check.........................................................Failed
- hook id: commitizen
- exit code: 2
usage: cz [-h] [--debug] [-n NAME] [--version]
{ls,commit,c,example,info,schema,bump,version,check,init} ...
cz: error: unrecognized arguments: poetry.lock requirements.txt
Steps to reproduce
.pre-commit-config.yaml
:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
- id: ruff
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/commitizen-tools/commitizen
rev: v1.17.0
hooks:
- id: commitizen
Current behavior
commitizen check.........................................................Failed
- hook id: commitizen
- exit code: 2
usage: cz [-h] [--debug] [-n NAME] [--version]
{ls,commit,c,example,info,schema,bump,version,check,init} ...
cz: error: unrecognized arguments: poetry.lock requirements.txt
If I then remove poetry.lock
and requirements.txt
, I get the following:
commitizen check.........................................................Failed
- hook id: commitizen
- exit code: 14
commit validation: failed!
please enter a commit message in the commitizen format.
commit: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
args: [--allow-multiple-documents]
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/psf/black
rev: 24.2.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
- id: ruff
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/commitizen-tools/commitizen
rev: v1.17.0
hooks:
- id: commitizen
pattern: (build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\(\S+\))?:\s.*
Where it seems like my whole .pre-commit-config.yaml
is included in the cz
command ran by the hook.
Desired behavior
commitizen check.........................................................Failed
- hook id: commitizen
- exit code: 14
commit validation: failed!
please enter a commit message in the commitizen format.
commit: asfpaihsagf(semrel): Update semrel stuff in pyproject
pattern: (build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert|bump)(\(\S+\))?:\s.*
Screenshots
No response
Environment
❯ python --version
Python 3.12.2