* [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml
@ 2026-06-17 11:35 Tom de Vries
2026-06-17 11:35 ` [PATCH 1/6] [pre-commit] Drop types_or filtering for tclint Tom de Vries
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Tom de Vries @ 2026-06-17 11:35 UTC (permalink / raw)
To: gdb-patches
A few patches dropping unnecessary settings, followed by a final patch
changing the layout a bit.
Tom de Vries (6):
[pre-commit] Drop types_or filtering for tclint
[pre-commit] Drop require_serial for pre-commit-setup
[pre-commit] Remove pass_filenames setting for check-whitespace
[pre-commit] Remove stages setting for two hooks
[pre-commit] Drop always_run setting for codespell-log
[pre-commit] Reorganize .pre-commit-config.yaml
.pre-commit-config.yaml | 68 ++++++++++++++++++++++-------------------
1 file changed, 36 insertions(+), 32 deletions(-)
base-commit: 7728a7b19010f6ec0912c5ca69f2b1747c3c2cf5
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/6] [pre-commit] Drop types_or filtering for tclint
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
@ 2026-06-17 11:35 ` Tom de Vries
2026-06-17 11:35 ` [PATCH 2/6] [pre-commit] Drop require_serial for pre-commit-setup Tom de Vries
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tom de Vries @ 2026-06-17 11:35 UTC (permalink / raw)
To: gdb-patches
The pre-commit tclint hook filters files using:
...
types_or: [file]
files: '^gdb/testsuite/.*\.(exp|tcl)$'
...
The types_or setting overrides the default file type of the hook. In the case
of tclint, there's no such default.
So this setting is not required, and causes additional filtering to run.
It was probably added by using one of the python hooks as a starting point.
Remove it.
---
.pre-commit-config.yaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a5b526b1eec..902e58d4d8c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -123,5 +123,4 @@ repos:
hooks:
- id: tclint
args: [--trust-plugins]
- types_or: [file]
files: '^gdb/testsuite/.*\.(exp|tcl)$'
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/6] [pre-commit] Drop require_serial for pre-commit-setup
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
2026-06-17 11:35 ` [PATCH 1/6] [pre-commit] Drop types_or filtering for tclint Tom de Vries
@ 2026-06-17 11:35 ` Tom de Vries
2026-06-17 11:35 ` [PATCH 3/6] [pre-commit] Remove pass_filenames setting for check-whitespace Tom de Vries
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tom de Vries @ 2026-06-17 11:35 UTC (permalink / raw)
To: gdb-patches
Now that we have pass_filenames=false for pre-commit hook pre-commit-setup,
there's no longer a requirement to have require_serial=true.
Remove the setting.
---
.pre-commit-config.yaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 902e58d4d8c..e5327cbae76 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -111,7 +111,6 @@ repos:
entry: gdb/contrib/pre-commit-setup.py
additional_dependencies: ["pyyaml"]
always_run: true
- require_serial: true
pass_filenames: false
- id: check-file-mode
name: check-file-mode
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/6] [pre-commit] Remove pass_filenames setting for check-whitespace
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
2026-06-17 11:35 ` [PATCH 1/6] [pre-commit] Drop types_or filtering for tclint Tom de Vries
2026-06-17 11:35 ` [PATCH 2/6] [pre-commit] Drop require_serial for pre-commit-setup Tom de Vries
@ 2026-06-17 11:35 ` Tom de Vries
2026-06-17 11:35 ` [PATCH 4/6] [pre-commit] Remove stages setting for two hooks Tom de Vries
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tom de Vries @ 2026-06-17 11:35 UTC (permalink / raw)
To: gdb-patches
The pre-commit hook check-whitespace has the following setting:
...
pass_filenames: true
...
Since true is the default for pass_filenames, remove the superfluous setting.
---
.pre-commit-config.yaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e5327cbae76..5be2034b26f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -103,7 +103,6 @@ repos:
language: unsupported_script
entry: gdb/contrib/check-whitespace-pre-commit.py
files: '^(gdb(support|server)?)/.*$'
- pass_filenames: true
stages: [pre-commit]
- id: pre-commit-setup
name: pre-commit-setup
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/6] [pre-commit] Remove stages setting for two hooks
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
` (2 preceding siblings ...)
2026-06-17 11:35 ` [PATCH 3/6] [pre-commit] Remove pass_filenames setting for check-whitespace Tom de Vries
@ 2026-06-17 11:35 ` Tom de Vries
2026-06-17 11:35 ` [PATCH 5/6] [pre-commit] Drop always_run setting for codespell-log Tom de Vries
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Tom de Vries @ 2026-06-17 11:35 UTC (permalink / raw)
To: gdb-patches
Some hooks have a setting:
...
stages: [pre-commit]
...
but since that's identical to the default setting:
...
default_stages: [pre-commit]
...
we can just remove those.
---
.pre-commit-config.yaml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5be2034b26f..b250cb1aea6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -97,13 +97,11 @@ repos:
files: '^(gdb(support|server)?)/.*\.(c|h|cc)$'
exclude: '.*/testsuite/.*'
verbose: true
- stages: [pre-commit]
- id: check-whitespace
name: check-whitespace
language: unsupported_script
entry: gdb/contrib/check-whitespace-pre-commit.py
files: '^(gdb(support|server)?)/.*$'
- stages: [pre-commit]
- id: pre-commit-setup
name: pre-commit-setup
language: python
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/6] [pre-commit] Drop always_run setting for codespell-log
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
` (3 preceding siblings ...)
2026-06-17 11:35 ` [PATCH 4/6] [pre-commit] Remove stages setting for two hooks Tom de Vries
@ 2026-06-17 11:35 ` Tom de Vries
2026-06-17 11:35 ` [PATCH 6/6] [pre-commit] Reorganize .pre-commit-config.yaml Tom de Vries
2026-06-17 19:28 ` [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom Tromey
6 siblings, 0 replies; 8+ messages in thread
From: Tom de Vries @ 2026-06-17 11:35 UTC (permalink / raw)
To: gdb-patches
The pre-commit codespell-log hook has an always_run=true setting.
This doesn't seem necessary for a commit-msg stage hook. Remove it.
---
.pre-commit-config.yaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b250cb1aea6..1d766189ca3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -77,7 +77,6 @@ repos:
name: codespell-log
entry: gdb/contrib/codespell-log.sh
args: [--toml, gdb/pyproject.toml]
- always_run: true
verbose: true
stages: [commit-msg]
- repo: local
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/6] [pre-commit] Reorganize .pre-commit-config.yaml
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
` (4 preceding siblings ...)
2026-06-17 11:35 ` [PATCH 5/6] [pre-commit] Drop always_run setting for codespell-log Tom de Vries
@ 2026-06-17 11:35 ` Tom de Vries
2026-06-17 19:28 ` [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom Tromey
6 siblings, 0 replies; 8+ messages in thread
From: Tom de Vries @ 2026-06-17 11:35 UTC (permalink / raw)
To: gdb-patches
Reorganize .pre-commit-config.yaml:
- unify indentation
- move local hooks to last
- add empty lines and header comments to make file more readable
- move detailed file selection comment from flake8 settings to
"Python hooks" since it's valid for all python hooks, and
explain why the types_or setting is needed.
- use anchors to avoid repetition
---
.pre-commit-config.yaml | 62 ++++++++++++++++++++++++-----------------
1 file changed, 36 insertions(+), 26 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1d766189ca3..141451501ed 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -40,25 +40,29 @@
minimum_pre_commit_version: 4.5.1
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [pre-commit]
+
repos:
+ # Python hooks. Run these for (in glob notation):
+ #
+ # - gdb/gdb-gdb.py.in
+ # - gdb/*.py
+ # - gdb/python/**/*.py
+ # - gdb/testsuite/*.py
+ #
+ # Because gdb/gdb-gdb.py.in is not classified as python, we use
+ # 'types_or: [file]' to override the default type for these hooks.
+ #
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.5.1
hooks:
- - id: black
- types_or: [file]
- files: '^gdb/.*\.py(\.in)?$'
+ - id: black
+ types_or: [file]
+ files: '^gdb/.*\.py(\.in)?$'
- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
types_or: [file]
- # Run this for (in glob notation):
- #
- # - gdb/gdb-gdb.py.in
- # - gdb/*.py
- # - gdb/python/**/*.py
- # - gdb/testsuite/*.py
- #
files: '^gdb/.*\.py(\.in)?$'
args: [--config, gdb/setup.cfg]
- repo: https://github.com/pycqa/isort
@@ -67,6 +71,8 @@ repos:
- id: isort
types_or: [file]
files: '^gdb/.*\.py(\.in)?$'
+
+ # Codespell hooks.
- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
hooks:
@@ -79,43 +85,47 @@ repos:
args: [--toml, gdb/pyproject.toml]
verbose: true
stages: [commit-msg]
+
+ # Tclint hooks.
+ - repo: https://github.com/nmoroze/tclint
+ rev: v0.8.0
+ hooks:
+ - id: tclint
+ args: [--trust-plugins]
+ files: '^gdb/testsuite/.*\.(exp|tcl)$'
+
+ # Local hooks.
- repo: local
hooks:
- - id: check-include-guards
- name: check-include-guards
+ - id: &id0 check-include-guards
+ name: *id0
language: unsupported_script
entry: gdb/check-include-guards.py
# All gdb header files, but not headers in the test suite.
files: '^(gdb(support|server)?)/.*\.h$'
exclude: '.*/testsuite/.*'
- - id: check-gnu-style
- name: check-gnu-style
+ - id: &id1 check-gnu-style
+ name: *id1
language: python
additional_dependencies: ['termcolor', 'unidiff']
entry: gdb/contrib/check-gnu-style-pre-commit.sh
files: '^(gdb(support|server)?)/.*\.(c|h|cc)$'
exclude: '.*/testsuite/.*'
verbose: true
- - id: check-whitespace
- name: check-whitespace
+ - id: &id2 check-whitespace
+ name: *id2
language: unsupported_script
entry: gdb/contrib/check-whitespace-pre-commit.py
files: '^(gdb(support|server)?)/.*$'
- - id: pre-commit-setup
- name: pre-commit-setup
+ - id: &id3 pre-commit-setup
+ name: *id3
language: python
entry: gdb/contrib/pre-commit-setup.py
additional_dependencies: ["pyyaml"]
always_run: true
pass_filenames: false
- - id: check-file-mode
- name: check-file-mode
+ - id: &id4 check-file-mode
+ name: *id4
language: unsupported_script
entry: gdb/contrib/check-file-mode.sh
files: '^(gdb|gdbserver|gdbsupport)/.*$'
- - repo: https://github.com/nmoroze/tclint
- rev: v0.8.0
- hooks:
- - id: tclint
- args: [--trust-plugins]
- files: '^gdb/testsuite/.*\.(exp|tcl)$'
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
` (5 preceding siblings ...)
2026-06-17 11:35 ` [PATCH 6/6] [pre-commit] Reorganize .pre-commit-config.yaml Tom de Vries
@ 2026-06-17 19:28 ` Tom Tromey
6 siblings, 0 replies; 8+ messages in thread
From: Tom Tromey @ 2026-06-17 19:28 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> A few patches dropping unnecessary settings, followed by a final patch
Tom> changing the layout a bit.
This all seems fine to me fwiw.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-06-17 19:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-17 11:35 [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom de Vries
2026-06-17 11:35 ` [PATCH 1/6] [pre-commit] Drop types_or filtering for tclint Tom de Vries
2026-06-17 11:35 ` [PATCH 2/6] [pre-commit] Drop require_serial for pre-commit-setup Tom de Vries
2026-06-17 11:35 ` [PATCH 3/6] [pre-commit] Remove pass_filenames setting for check-whitespace Tom de Vries
2026-06-17 11:35 ` [PATCH 4/6] [pre-commit] Remove stages setting for two hooks Tom de Vries
2026-06-17 11:35 ` [PATCH 5/6] [pre-commit] Drop always_run setting for codespell-log Tom de Vries
2026-06-17 11:35 ` [PATCH 6/6] [pre-commit] Reorganize .pre-commit-config.yaml Tom de Vries
2026-06-17 19:28 ` [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox