ClickHouse/utils/check-style/check-doc-aspell
2022-06-08 14:26:02 +02:00

29 lines
923 B
Bash
Executable File

#!/usr/bin/env bash
# Perform spell checking on the docs
# Files casesensitive.txt and caseinsensitive.txt contains words to ignore (case insensitive and sensitive respectively)
# File todo.txt needs to be revised which words is actual misspellings
ROOT_PATH=$(git rev-parse --show-toplevel)
CHECK_LANG=${1:-en}
ASPELL_IGNORE_PATH="${ROOT_PATH}/utils/check-style/aspell-ignore/${CHECK_LANG}"
STATUS=0
for fname in ${ROOT_PATH}/docs/${CHECK_LANG}/**/*.md; do
errors=$(aspell list --mode=markdown --lang=${CHECK_LANG} < "$fname" \
| grep -Ewv -f "${ASPELL_IGNORE_PATH}/todo.txt" \
| grep -Ewvi -f "${ASPELL_IGNORE_PATH}/caseinsensitive.txt" \
| grep -Ewv -f "${ASPELL_IGNORE_PATH}/casesensitive.txt" \
| grep -Ewv "[A-Z]+" \
| sort | uniq)
if [ ! -z "$errors" ]; then
STATUS=1
echo "====== $fname ======"
echo "$errors"
fi
done
exit ${STATUS}