summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBrett Holman <bholman.devel@gmail.com>2022-02-02 14:21:00 -0700
committerGitHub <noreply@github.com>2022-02-02 15:21:00 -0600
commit7522845dfe8851b7b4f3e9924810b9ccf282bb6e (patch)
tree0f40492cf5bc32bc5084ca9a4cf8983abf963271 /Makefile
parent490cefd72d6e282804b877e9448438247e956f34 (diff)
downloadvyos-cloud-init-7522845dfe8851b7b4f3e9924810b9ccf282bb6e.tar.gz
vyos-cloud-init-7522845dfe8851b7b4f3e9924810b9ccf282bb6e.zip
spell check docs with spellintian (#1223)
Fix spelling errors - Add Makefile target that checks for spelling errors - Add Makefile target that fixes spelling errors - Add spelling check to travis doc tests - Fix various spelling errors in the docs
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 38 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 0c015dae..4ead786f 100644
--- a/Makefile
+++ b/Makefile
@@ -83,6 +83,43 @@ deb-src:
doc:
tox -e doc
+# Spell check && filter false positives
+_CHECK_SPELLING := find doc -type f -exec spellintian {} + | \
+ grep -v -e 'doc/rtd/topics/cli.rst: modules modules' \
+ -e 'doc/examples/cloud-config-mcollective.txt: WARNING WARNING' \
+ -e 'doc/examples/cloud-config-power-state.txt: Bye Bye' \
+ -e 'doc/examples/cloud-config.txt: Bye Bye'
+
+
+# For CI we require a failing return code when spellintian finds spelling errors
+check_spelling:
+ @! $(_CHECK_SPELLING)
+
+# Manipulate the output of spellintian into a valid "sed" command which is run
+# to fix the error
+#
+# Example spellintian output:
+#
+# doc/examples/kernel-cmdline.txt: everthing -> everything
+#
+# The "fix_spelling" target manipulates the above output into the following command
+# and runs that command.
+#
+# sed -i "s/everthing/everything/g" doc/examples/kernel-cmdline.txt
+#
+# awk notes:
+#
+# -F ': | -> ' means use the strings ": " or " -> " as field delimeters
+# \046 is octal for double quote
+# $$2 will contain the second field, ($ must be escaped because this is in a Makefile)
+#
+# Limitation: duplicate words with newline between them are not automatically fixed
+fix_spelling:
+ @$(_CHECK_SPELLING) | \
+ sed 's/ (duplicate word)//g' | \
+ awk -F ': | -> ' '{printf "sed -i \047s/%s/%s/g\047 %s\n", $$2, $$3, $$1}' | \
+ sh
+
.PHONY: test flake8 clean rpm srpm deb deb-src yaml
.PHONY: check_version pip-test-requirements pip-requirements clean_pyc
-.PHONY: unittest style-check doc
+.PHONY: unittest style-check doc fix_spelling check_spelling