New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pre-commit: "Expected one of commit, commit-msg, manual, ..." since 23.11.0 #4065
Comments
According to https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md#320---2023-03-17 the "pre-commit" value should be allowed since 3.2.0, but I think I have 3.5.0 installed. Looking in site-packages/pre_commit/clientlib.py, I see:
That looks correct |
The |
Does executing |
Yes, it does :-) Interesting. I need to check what happens there. Is the update of |
@Wolfcast: Your error message says Try updating python3 -m pip install --upgrade pre-commit |
@davidculley Yeah I deleted my comment before your reply :) The global pre-commit was up to date but not the one in my venv. |
IMO this solution is preferable #4041 The current version of Debian uses pre-commit 3.0.4, so it would be nice for it to work on that. |
Ubuntu 22.04 LTS (jammy) has pre-commit 2.17.0 https://packages.ubuntu.com/jammy/pre-commit |
What am I missing @andrewmwilson @marcindulak, why can't Debian/Ubuntu users not execute |
In hobby projects it's possible to pull packages from the internet, but in enterprises someone with required permissions would need to modify CI systems and developer machine images to include that change. Additionally, a custom installation of pre-commit brings additional packages (see example below), and those would create a liability by extending the need of scanning them for vulnerabilities and patching, while those tasks are normally delegated to the operating system vendor
|
Still getting the error after a |
For $ poetry remove pre-commit
Updating dependencies
Resolving dependencies... (0.5s)
Package operations: 0 installs, 0 updates, 6 removals
• Removing cfgv (3.4.0)
• Removing identify (2.5.33)
• Removing nodeenv (1.8.0)
• Removing pre-commit (2.21.0)
• Removing pyyaml (6.0.1)
• Removing setuptools (69.0.2)
Writing lock file Then add it: $ poetry add pre-commit --group dev
Using version ^3.6.0 for pre-commit
Updating dependencies
Resolving dependencies... (0.8s)
Package operations: 6 installs, 0 updates, 0 removals
• Installing setuptools (69.0.2)
• Installing cfgv (3.4.0)
• Installing identify (2.5.33)
• Installing nodeenv (1.8.0)
• Installing pyyaml (6.0.1)
• Installing pre-commit (3.6.0)
Writing lock file |
Note for anyone currently broken by this, you can try using psf/black-pre-commit-mirror instead. This never received the change in #3940, so should still work with older versions of pre-commit. It'll also make black like 2x faster :-) |
Thanks for the explanation @marcindulak and sorry for the late answer. I haven't thus far found myself in such a situation, therefore I wasn't aware of the issues you describe. Now I can better put myself in your shoes, thank you. |
Describe the bug
When the pre-commit hook is installed and I commit, I get:
To Reproduce
The resulting error is:
Expected behavior
A pre-commit fixes
c.py
Environment
Additional context
#3940
The text was updated successfully, but these errors were encountered: