diff options
author | Tom de Vries <tdevries@suse.de> | 2025-02-04 22:07:22 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-02-04 22:07:22 +0100 |
commit | f784fcab5a74d0dff754ae9deb263006c0a19fcf (patch) | |
tree | a27d29cfcf443a7b979a8d5f4bd5431d69e52b71 | |
parent | 874162eb9fc8c067ebbaa1e56fad5d6ca5c93e63 (diff) | |
download | binutils-f784fcab5a74d0dff754ae9deb263006c0a19fcf.zip binutils-f784fcab5a74d0dff754ae9deb263006c0a19fcf.tar.gz binutils-f784fcab5a74d0dff754ae9deb263006c0a19fcf.tar.bz2 |
[pre-commit] Require pre-commit version 3.2.0
Recent commit 0bd340d6704 ("pre-commit autoupdate") bumped the isort version
to 6.0.0.
Subsequently, I started running into:
...
$ SKIP=flake8,isort pre-commit run
An error has occurred: InvalidManifestError:
==> File /home/vries/.cache/pre-commit/repommstqefj/.pre-commit-hooks.yaml
==> At Hook(id='isort')
==> 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'
Check the log at /home/vries/.cache/pre-commit/pre-commit.log
...
I found a similar PR [1], that explains that using pre-commit as a stage (as
isort 6.0.0 does) is supported starting pre-commit 3.2.0.
Add minimum_pre_commit_version 3.2.0 in .pre-commit-config.yaml, as suggested
in the PR.
After adding this, I get a more helpful message:
...
$ SKIP=flake8,isort pre-commit run
An error has occurred: InvalidConfigError:
==> File .pre-commit-config.yaml
==> At Config()
==> At key: minimum_pre_commit_version
=====> pre-commit version 3.2.0 is required but version 2.17.0 is installed. \
Perhaps run `pip install --upgrade pre-commit`.
Check the log at /home/vries/.cache/pre-commit/pre-commit.log
...
and after doing so which upgrades pre-commit to version 4.1.0, as well as
re-installing pre-commit using:
...
$ pre-commit uninstall
$ pre-commit install
...
I have a functional setup again.
Interestingly, since pre-commit 4.1.0 runs in a python 3.11 environment, I no
longer need to skip flake8 and isort, as I needed to previously when the
system python 3.6 was used.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
[1] https://github.com/psf/black/issues/4065
-rw-r--r-- | .pre-commit-config.yaml | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eed31d7..be3ee82 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,6 +37,7 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks +minimum_pre_commit_version: 3.2.0 repos: - repo: https://github.com/psf/black-pre-commit-mirror rev: 25.1.0 |