summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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