[PATCH 5/5] [pre-commit] Don't require text type for codespell hook

Tom de Vries <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Codespell's .pre-commit-hooks.yaml sets "types: [text]".

Override this using "types: [file]", to make the codespell hook see the same
files as codespell usage outside pre-commit:
...
$ codespell --toml gdb/pyproject.toml gdb*
...

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34411
---
 .pre-commit-config.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 260cae67e56..aeb3058f725 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -92,6 +92,11 @@ repos:
     - id: codespell
       args: &codespell_args [--toml, gdb/pyproject.toml]
       files: &gdb_files '^(gdb|gdbserver|gdbsupport)/'
+      # Override the [text] setting in .pre-commit-hooks.yaml, allowing this
+      # hook to see the same files as codespell usage outside pre-commit.
+      # Instead, filter files in gdb/pyproject.toml.
+      types: *types_default
+      types_or: *types_or_default
     - id: codespell
       name: codespell-log
       entry: gdb/contrib/codespell-log.sh
-- 
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.