pre-commit: "Expected one of commit, commit-msg, manual, ..." since 23.11.0
envgap__psf__black-4065
Original GitHub issue ↗Opened 2023-11-21
01 / FAILURE SIGNATURE
As reported upstream
An error has occurred: InvalidManifestError:
Not a benchmark task.
- No curated issue-specific recipe or verified environment fix is available.
02 / ENVIRONMENT RECIPE
- Base commit
Not freshly verified- Manifest
requirements.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
psf/black #4065 · read the original issue
<!--
Please make sure that the bug is not already fixed either in newer versions or the
current development version. To confirm this, you have three options:
1. Update Black's version if a newer release exists: `pip install -U black`
2. Use the online formatter at <https://black.vercel.app/?version=main>, which will use
the latest main branch.
3. Or run _Black_ on your machine:
- create a new virtualenv (make sure it's the same Python version);
- clone this repository;
- run `pip install -e .[d]`;
- run `pip install -r test_requirements.txt`
- make sure it's sane by running `python -m pytest`; and
- run `black` like you did last time.
-->
**Describe the bug**
When the pre-commit hook is installed and I commit, I get:
```
An error has occurred: InvalidManifestError:
==> File /home/martin/.cache/pre-commit/repolc31_gpb/.pre-commit-hooks.yaml
==> At Hook(id='black')
==> At key: stages
==> At index 0
=====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit'
```
**To Reproduce**
```
$ python --version
3.11.1
$ python -m venv venv
$ source venv/bin/activate
$ vim .pre-commit-config.yaml
# Add this:
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
$ echo "a = 'b'" > c.py
$ git init
$ git add .pre-commit-config.yaml c.py
$ pip install pre-commit
$ pre-commit install
$ pre-commit --version
pre-commit 3.5.0
$ git commit -m "Example"
```
The resulting error is:
```
An error has occurred: InvalidManifestError:
==> File /home/martin/.cache/pre-commit/repolc31_gpb/.pre-commit-hooks.yaml
==> At Hook(id='black')
==> At key: stages
==> At index 0
=====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit'
```
**Expected behavior**
A pre-commit fixes `c.py`
**Environment**
- Black's version: 23.11.0
- OS and Python version: Linux / Python 3.11.1
**Additional context**
https://github.com/psf/black/pull/394004 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]
Issue-specific recipe and runtime smoke command require review against the complete issue and repository.
Legacy already_works is install-only; proposed control still requires runtime verification.