[binutils-gdb] [pre-commit] Move gdb/contrib/setup.cfg to gdb/pyproject.toml
Tom de Vries via Gdb-cvs <[email protected]> Mon, 1 Jun 2026 12:34:01 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <20260601123401.C24D84BA2E11__10514.4186339871$1780317253$gmane$org@sourceware.org> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ee854776d0e83782444d33058f31c244961ac0b9 commit ee854776d0e83782444d33058f31c244961ac0b9 Author: Tom de Vries <[email protected]> Date: Mon Jun 1 14:33:48 2026 +0200 [pre-commit] Move gdb/contrib/setup.cfg to gdb/pyproject.toml The codespell settings are currently in gdb/contrib/setup.cfg. There's a goal to move settings of Python tools used for gdb to gdb/pyproject.toml. Do so, and update the args entries in .pre-commit-config.yaml: ... - args: [--config, gdb/contrib/setup.cfg] + args: [--toml, gdb/pyproject.toml] ... It's necessary to point codespell as used in pre-commit to the pyproject.toml file, because: - pre-commit uses codespell with the repository root as working directory - codespell currently only supports discovery of configuration files in the working directory. There's an issue open to support hierarchical pyproject.toml files [1]. Likewise, it's necessary to point codespell on the CLI to the pyproject.toml file: ... $ codespell --toml gdb/pyproject.toml ... Now that the codespell settings are in gdb/pyproject.toml, codespell will automatically discover it when running codespell in the gdb directory. However, that's not useful, because the paths in gdb/pyproject.toml are relative to the repository root. Hopefully, that will be fixed once codespell supports hierarchical toml files. In the mean time, we could fix this by moving the settings to a pyproject.toml file in the repository root. But we have been avoiding this sofar (to keep project-related things out of the repository root as much as possible), so we continue having this pre-existing issue. [1] https://github.com/codespell-project/codespell/issues/3737 Diff: --- .pre-commit-config.yaml | 4 ++-- gdb/contrib/setup.cfg | 13 ------------- gdb/pyproject.toml | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2813a7484fd..5fd2360ce49 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,11 +72,11 @@ repos: hooks: - id: codespell files: '^(gdbsupport|gdbserver|gdb/(dwarf2|tui|target|data-directory|po|system-gdbinit|mi|syscalls|arch|regformats|compile|python|guile|config|unittests|cli|testsuite/gdb.(ctf|dap|debuginfod|gdb|go|guile|mi|modula2|objc|opencl|opt|pascal|perf|replay|reverse|rocm|server|stabs|testsuite|tui|xml)))/' - args: [--config, gdb/contrib/setup.cfg] + args: [--toml, gdb/pyproject.toml] - id: codespell name: codespell-log entry: gdb/contrib/codespell-log.sh - args: [--config, gdb/contrib/setup.cfg] + args: [--toml, gdb/pyproject.toml] always_run: true verbose: true stages: [commit-msg] diff --git a/gdb/contrib/setup.cfg b/gdb/contrib/setup.cfg deleted file mode 100644 index f6c4635d3c8..00000000000 --- a/gdb/contrib/setup.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[codespell] - -# Skip ChangeLogs and generated files. -skip = */ChangeLog*,*/configure,gdbsupport/Makefile.in,*.dat,*.eps,gdb/features/*.c,gdb/ada-casefold.h,gdb/copying.c,gdb/gdbarch-gen.h,gdb/gdbarch-gen.c,gdb/target-delegates-gen.c,gdb/aclocal.m4,gdbserver/aclocal.m4,gdbsupport/aclocal.m4 - -ignore-words = gdb/contrib/codespell-ignore-words.txt -dictionary = gdb/contrib/codespell-dictionary.txt,- - -# Ignore all URLs. -uri-ignore-words-list = * - -# How to ignore blocks of code. -ignore-multiline-regex = codespell:ignore-begin.*?codespell:ignore-end diff --git a/gdb/pyproject.toml b/gdb/pyproject.toml index e72365c58f9..4109dfb8f82 100644 --- a/gdb/pyproject.toml +++ b/gdb/pyproject.toml @@ -54,3 +54,17 @@ indent-namespace-eval = true # Used by tclfmt. spaces-in-braces = false + +[tool.codespell] + +# Skip ChangeLogs and generated files. +skip = '*/ChangeLog*,*/configure,gdbsupport/Makefile.in,*.dat,*.eps,gdb/features/*.c,gdb/ada-casefold.h,gdb/copying.c,gdb/gdbarch-gen.h,gdb/gdbarch-gen.c,gdb/target-delegates-gen.c,gdb/aclocal.m4,gdbserver/aclocal.m4,gdbsupport/aclocal.m4' + +ignore-words = 'gdb/contrib/codespell-ignore-words.txt' +dictionary = 'gdb/contrib/codespell-dictionary.txt,-' + +# Ignore all URLs. +uri-ignore-words-list = '*' + +# How to ignore blocks of code. +ignore-multiline-regex = 'codespell:ignore-begin.*?codespell:ignore-end'