]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdbsupport] Add codespell section in setup.cfg
authorTom de Vries <tdevries@suse.de>
Thu, 6 Mar 2025 16:38:32 +0000 (17:38 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 6 Mar 2025 16:38:32 +0000 (17:38 +0100)
When running codespell on gdbsupport, we get:
...
$ codespell gdbsupport
gdbsupport/common-debug.h:218: invokable ==> invocable
gdbsupport/osabi.h:51: configury ==> configurable
gdbsupport/ChangeLog-2020-2021:344: ro ==> to, row, rob, rod, roe, rot
gdbsupport/ChangeLog-2020-2021:356: contaning ==> containing
gdbsupport/common.m4:19: configury ==> configurable
gdbsupport/Makefile.am:97: configury ==> configurable
gdbsupport/Makefile.in:811: configury ==> configurable
gdbsupport/event-loop.cc:84: useable ==> usable
gdbsupport/configure:15904: assigment ==> assignment
...

Some of these files we want to skip in a spell check, because they're
generated.  We also want to skip ChangeLogs, we don't actively maintain those.

Add a file gdbsupport/setup.cfg with a codespell section, that skips those
files.  The choice for setup.cfg (rather than say .codespellrc) comes from the
presence of gdb/setup.cfg.

That leaves invokable, configury and useable.  I think configury is a common
expression in our context, and for invokable and useable I don't manage to
find out whether they really need rewriting, so I'd rather leave them alone
for now.

Add these to a file gdb/contrib/codespell-ignore-words.txt, and use the file in
gdbsupport/setup.cfg.

This makes the directory codespell clean:
...
$ codespell --config gdbsupport/setup.cfg gdbsupport
$
...

Because codespell seems to interpret filenames relative to the working
directory rather than relative to the config file, and the filename used in
gdbsupport/setup.cfg is gdb/contrib/codespell-ignore-words.txt, this simple
invocation doesn't work:
...
$ cd gdbsupport
$ codespell
...
because codespell can't find gdbsupport/gdb/contrib/codespell-ignore-words.txt.

We could fix this by using ../gdb/contrib/codespell-ignore-words.txt instead, but
likewise that breaks this invocation:
...
$ codespell --config gdbsupport/setup.cfg gdbsupport
...

I can't decide which one is worse, so I'm sticking with
gdb/contrib/codespell-ignore-words.txt for now.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/contrib/codespell-ignore-words.txt [new file with mode: 0644]
gdbsupport/setup.cfg [new file with mode: 0644]

diff --git a/gdb/contrib/codespell-ignore-words.txt b/gdb/contrib/codespell-ignore-words.txt
new file mode 100644 (file)
index 0000000..a8287f7
--- /dev/null
@@ -0,0 +1,3 @@
+configury
+invokable
+useable
diff --git a/gdbsupport/setup.cfg b/gdbsupport/setup.cfg
new file mode 100644 (file)
index 0000000..e3e9298
--- /dev/null
@@ -0,0 +1,4 @@
+[codespell]
+# Skip ChangeLogs and generated files.
+skip = ChangeLog*,Makefile.in,configure
+ignore-words = gdb/contrib/codespell-ignore-words.txt