On 31/10/2022 08.43, Stefan Weil wrote:
`make check-spelling` can now be used to get a list of spelling errors.
It uses the latest version of codespell, a spell checker implemented in Python.
Signed-off-by: Stefan Weil <s...@weilnetz.de>
---
This RFC can already be used for manual tests, but still reports false
positives, mostly because some variable names are interpreted as words.
These words can either be ignored in the check, or in some cases the code
might be changed to use different variable names.
The check currently only skips a few directories and files, so for example
checked out submodules are also checked.
The rule can be extended to allow user provided ignore and skip lists,
for example by introducing Makefile variables CODESPELL_SKIP=userfile
or CODESPELL_IGNORE=userfile. A limited check could be implemented by
providing a base directory CODESPELL_START=basedirectory, for example
CODESPELL_START=docs.
Regards,
Stefan
tests/Makefile.include | 10 ++++++++++
tests/codespell/README.rst | 18 ++++++++++++++++++
tests/codespell/exclude-file | 3 +++
tests/codespell/ignore-words | 19 +++++++++++++++++++
tests/requirements.txt | 1 +
5 files changed, 51 insertions(+)
create mode 100644 tests/codespell/README.rst
create mode 100644 tests/codespell/exclude-file
create mode 100644 tests/codespell/ignore-words
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9422ddaece..b9daeda932 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -155,6 +155,16 @@ check-acceptance-deprecated-warning:
check-acceptance: check-acceptance-deprecated-warning | check-avocado
+.PHONY: check-spelling
+CODESPELL_DIR=tests/codespell
+check-spelling: check-venv
+ source $(TESTS_VENV_DIR)/bin/activate && \
+ cd "$(SRC_PATH)" && \
+ codespell -s . \
+ --exclude-file=$(CODESPELL_DIR)/exclude-file \
+ --ignore-words=$(CODESPELL_DIR)/ignore-words \
+ --skip="./.git,./bin,./build,./linux-headers,*.patch,nohup.out"
I like the idea, but I think it's unlikely that we can make this work for
the whole source tree any time soon. So maybe it makes more sense to start
with some few directories first (e.g. docs/ ) and then the maintainers can
opt-in by cleaning up their directories first and then by adding their
directories to this target here?
Thomas