From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 6/6] [pre-commit] Reorganize .pre-commit-config.yaml
Date: Wed, 17 Jun 2026 13:35:09 +0200 [thread overview]
Message-ID: <20260617113509.3510116-7-tdevries@suse.de> (raw)
In-Reply-To: <20260617113509.3510116-1-tdevries@suse.de>
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
next prev parent reply other threads:[~2026-06-17 11:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Tom de Vries [this message]
2026-06-17 19:28 ` [PATCH 0/6] [pre-commit] Clean up .pre-commit-config.yaml Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260617113509.3510116-7-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox