Skip to content

Commit

Permalink
Add new build targets 'check-spelling' and 'check-spelling-docs'
Browse files Browse the repository at this point in the history
`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 <[email protected]>
  • Loading branch information
stweil committed Sep 9, 2024
1 parent 0e3b525 commit aba99fe
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ check-functional:
@$(NINJA) precache-functional
@QEMU_TEST_NO_DOWNLOAD=1 $(MAKE) SPEED=thorough check-func check-func-quick

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
Expand Down
21 changes: 21 additions & 0 deletions tests/codespell/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
=============================
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.

A 2nd target `check-spelling-docs` checks the generated documentation
which is presented to end users.

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
6 changes: 6 additions & 0 deletions tests/codespell/exclude-file
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* 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
<dt><code class="docutils literal notranslate"><span class="pre">crypted</span></code>: <code class="docutils literal notranslate"><span class="pre">boolean</span></code></dt><dd><p>true if password is already crypt()d, false if raw</p>
<p>If the <code class="docutils literal notranslate"><span class="pre">crypted</span></code> flag is true, it is the caller’s responsibility
<code class="docutils literal notranslate"><span class="pre">crypted</span></code> flag, as they may require the clear-text password</p>
24 changes: 24 additions & 0 deletions tests/codespell/ignore-words
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
asign
bu
buid
busses
conectix
dout
falt
fpr
hace
hax
hda
inflight
nd
ot
pard
parm
ptd
ser
sie
som
stap
synopsys
te
ue

0 comments on commit aba99fe

Please sign in to comment.