@@ -155,6 +155,25 @@ check-acceptance-deprecated-warning:
check-acceptance: check-acceptance-deprecated-warning | check-avocado
+CODESPELL_DIR=$(SRC_PATH)/tests/codespell
+
+.PHONY: check-spelling
+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,./roms,*.patch,nohup.out"
+
+.PHONY: check-spelling-docs
+check-spelling-docs: check-venv
+ source $(TESTS_VENV_DIR)/bin/activate && \
+ codespell -s docs \
+ --exclude-file=$(CODESPELL_DIR)/exclude-file \
+ --ignore-words=$(CODESPELL_DIR)/ignore-words \
+ --skip="docs/manual/_static,docs/manual/searchindex.js,nohup.out"
+
# Consolidated targets
.PHONY: check check-clean get-vm-images
new file mode 100644
@@ -0,0 +1,18 @@
+=============================
+Check spelling with codespell
+=============================
+
+`make check-spelling` can be used to get a list of spelling errors.
+It reports files with spelling errors and a summary of all misspelled words.
+The report is generated by the latest version of codespell, a spell checker
+implemented in Python.
+
+See https://github.com/codespell-project/codespell for more information.
+
+Some file patterns are excluded from the check.
+
+In addition tests/codespell includes several files which are used to
+suppress certain false positives in the codespell report.
+
+exclude-file - complete lines which should be ignored
+ignore-words - list of words which should be ignored
new file mode 100644
@@ -0,0 +1,3 @@
+ * VAS controller.
+number generator daemon such as the one found in the vhost-device crate of
+introspection. The latter can conceivably confuse clients, so tread
new file mode 100644
@@ -0,0 +1,21 @@
+asign
+bu
+buid
+busses
+conectix
+dout
+falt
+fpr
+hace
+hax
+hda
+nd
+ot
+pard
+parm
+ptd
+ser
+som
+synopsys
+te
+ue
@@ -4,3 +4,4 @@
# Note that qemu.git/python/ is always implicitly installed.
avocado-framework==88.1
pycdlib==1.11.0
+codespell
`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. 'make check-spelling-docs' checks the generated documentation. Signed-off-by: Stefan Weil <sw@weilnetz.de> --- v2: Additional target check-spelling-docs, updated ignore-words 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. After fixing some typos (patch was just sent to the list), these "typos" remain in the generated documentation: SUMMARY: crypted 3 ede 4 inflight 32 informations 3 mor 1 vas 1 Regards, Stefan tests/Makefile.include | 19 +++++++++++++++++++ tests/codespell/README.rst | 18 ++++++++++++++++++ tests/codespell/exclude-file | 3 +++ tests/codespell/ignore-words | 21 +++++++++++++++++++++ tests/requirements.txt | 1 + 5 files changed, 62 insertions(+) create mode 100644 tests/codespell/README.rst create mode 100644 tests/codespell/exclude-file create mode 100644 tests/codespell/ignore-words