traefik/script/validate-misspell

30 lines
650 B
Text
Raw Normal View History

#!/usr/bin/env bash
2016-11-16 09:12:49 +00:00
IFS=$'\n'
2019-04-01 13:30:07 +00:00
files=( $( git ls-files 'docs/*.md' *.md ) )
2016-11-16 09:12:49 +00:00
unset IFS
errors=()
for f in "${files[@]}"; do
# we use source text here so we also check spelling of variable names
failedSpell=$(misspell -source=text "$f")
if [ "$failedSpell" ]; then
errors+=( "$failedSpell" )
fi
done
if [ ${#errors[@]} -eq 0 ]; then
2017-05-26 21:46:47 +00:00
echo 'Congratulations! All Go source files and docs have been checked for common misspellings.'
2016-11-16 09:12:49 +00:00
else
{
echo "Errors from misspell:"
for err in "${errors[@]}"; do
echo "$err"
done
echo
echo 'Please fix the above errors. You can test via "misspell" and commit the result.'
echo
} >&2
false
fi