Skip to content

Commit

Permalink
Fixed documentation spellchecking.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Jan 13, 2024
1 parent 07a4561 commit cf2d9b7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .drevops/docs/.utils/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
set -eu
[ "${DREVOPS_DEBUG-}" = "1" ] && set -x

CUR_DIR="$(dirname "${BASH_SOURCE[0]}")"
cur_dir="$(dirname "${BASH_SOURCE[0]}")"

DICTIONARY="${CUR_DIR}/.aspell.en.pws"
dictionary="${cur_dir}/.aspell.en.pws"

targets=()
while IFS= read -r -d $'\0'; do
targets+=("${REPLY}")
done < <(
find \
"${CUR_DIR}/.." \
"${cur_dir}/.." \
-type f \
\( -name "*.md" \) \
-not -path "*vendor*" -not -path "*node_modules*" \
-print0
)

echo -n "==> Validating dictionary."
if head -1 "${DICTIONARY}" | grep -q "personal_ws-1.1 en 28"; then
if head -1 "${dictionary}" | grep -q "personal_ws-1.1 en 28"; then
echo "OK"
else
echo "ERROR: invalid dictionary format"
Expand All @@ -45,14 +45,14 @@ for file in "${targets[@]}"; do
# Remove HTML.
sed -E 's/<([^<]+)>//g' |
# Remove code blocks.
sed -n '/\`\`\`/,/\`\`\`/ !p' |
sed '/^```/,/^```/d' |
# Remove inline code.
sed -n '/\`/,/\`/ !p' |
sed 's/`[^`]*`//g' |
# Remove anchors.
sed -E 's/\[.+\]\([^\)]+\)//g' |
# Remove links.
sed -E 's/http(s)?:\/\/([^ ]+)//g' |
aspell --lang=en --encoding=utf-8 --personal="${DICTIONARY}" list | tee /dev/stderr | [ "$(wc -l)" -eq 0 ]
aspell --lang=en --encoding=utf-8 --personal="${dictionary}" list | tee /dev/stderr | [ "$(wc -l)" -eq 0 ]

if [ "$?" -ne 0 ]; then
exit 1
Expand Down

0 comments on commit cf2d9b7

Please sign in to comment.