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

28 lines
886 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 -v -f "${ASPELL_IGNORE_PATH}/todo.txt" \
| grep -vi -f "${ASPELL_IGNORE_PATH}/caseinsensitive.txt" \
| grep -v -f "${ASPELL_IGNORE_PATH}/casesensitive.txt" \
| sort | uniq)
if [ ! -z "$errors" ]; then
STATUS=1
echo "====== $fname ======"
echo "$errors"
fi
done
exit ${STATUS}