[pushed] [pre-commit] Set stages for isort

Tom de Vries <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
I noticed that isort runs for the manual stage:
...
$ pre-commit run --hook-stage manual
isort...............................................(no files to check)Skipped
...

That happens because unlike any other repo we're currently using, isort's
.pre-commit-hooks.yaml sets stages:
...
stages: [pre-commit, pre-merge-commit, pre-push, manual]
...
overriding the default setting in our .pre-commit-config.yaml:
...
default_stages: [pre-commit]
...

Fix this by adding a stages setting to the isort hook.
---
 .pre-commit-config.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 141f14ba72c..60164e446fc 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -74,6 +74,9 @@ repos:
     - id: isort
       types_or: *gdb_python_types
       files: *gdb_python_files
+      # Isort's .pre-commit-hooks.yaml sets stages, overriding default_stages,
+      # so this hook needs an explicit setting.
+      stages: [pre-commit]
 
   # Codespell hooks.
   - repo: https://github.com/codespell-project/codespell

base-commit: 705b16039e6f1e499b96d8ecd08d5154f62d7d38
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.