From 4a4edb5807d094f22788c7fbd23b05a29ef98bdc Mon Sep 17 00:00:00 2001 From: Thibault Kruse Date: Fri, 13 May 2016 23:14:52 +0900 Subject: [PATCH 1/2] add hunspell spell checks, fix bugs in generation of plaintext file --- .travis.yml | 5 + scripts/Makefile | 15 + scripts/hunspell/isocpp.dic | 539 ++++++++++++++++++++++++++++++++++++ scripts/python/md-split.py | 16 +- 4 files changed, 566 insertions(+), 9 deletions(-) create mode 100644 scripts/hunspell/isocpp.dic diff --git a/.travis.yml b/.travis.yml index 222ad98..64550f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,11 @@ language: c++ # alternatives: gcc, clang, or both (as yaml list) compiler: clang +addons: + apt: + packages: + - hunspell + install: - diff --git a/scripts/Makefile b/scripts/Makefile index ada1344..133737e 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -17,6 +17,7 @@ all: \ check-markdown \ check-references \ check-notabs \ +hunspell-check \ cpplint-all \ check-badchars @@ -78,6 +79,17 @@ check-badchars: $(SOURCEPATH) $(BUILD_DIR) Makefile if [ -s $(BUILD_DIR)/CppCoreGuidelines.md.badchars ]; then echo 'Warning: Undesired chars (–’‘“”¸…¦) found, use straight quotes instead:'; cat $(BUILD_DIR)/CppCoreGuidelines.md.badchars; false; fi; +.PHONY: hunspell-check +hunspell-check: $(BUILD_DIR)/plain-nohtml.txt + hunspell -p hunspell/isocpp.dic -u < build/plain-nohtml.txt > $(BUILD_DIR)/hunspell-report.txt + if [ -s $(BUILD_DIR)/hunspell-report.txt ]; then echo 'Warning: Spellcheck failed, fix words or add to dictionary:'; cat $(BUILD_DIR)/hunspell-report.txt; false; fi; + +# only list words that are not in dict +# to include all add them to bottom of hunspell/isocpp.dict, and run +# cat hunspell/isocpp.dic | sort | uniq > hunspell/isocpp.dic2; mv hunspell/isocpp.dic2 hunspell/isocpp.dic +.PHONY: hunspell-list +hunspell-list: $(BUILD_DIR)/plain.txt + hunspell -p hunspell/isocpp.dic -l < build/plain-nohtml.txt #### Cpplint @@ -96,6 +108,9 @@ $(BUILD_DIR)/codeblocks: splitfile $(BUILD_DIR)/plain.txt: splitfile +$(BUILD_DIR)/plain-nohtml.txt: $(BUILD_DIR)/plain.txt + sed 's; CppCoreGuidelines.md.uniq - - if [[ -s CppCoreGuidelines.md.uniq ]]; then echo 'Found duplicate anchors:'; cat CppCoreGuidelines.md.uniq; false; fi; - - notifications: email: false