traefik/script/validate-misspell
Timo Reimann 49a09ab7dd Prepare for dependency vendoring.
- Add helper script to simplify glide usage.
- Add validation script for unwanted changes to vendoring.
- Relax/tighten up .{git,docker}ignore to cover vendored files properly.
- .validate: Protect from unbound variable in case of nounset setting.
- Install more recent hg version in the build container.
- Remove glide installation steps from Dockerfile.
- Update documentation.
2017-03-08 22:21:12 +01:00

34 lines
869 B
Bash
Executable file

#!/bin/bash
source "$(dirname "$BASH_SOURCE")/.validate"
IFS=$'\n'
src=( $(validate_diff --diff-filter=ACMR --name-only -- '*.go' | grep -v '^\(integration/\)\?vendor/\|autogen' || true) )
docs=( $(validate_diff --diff-filter=ACMR --name-only -- 'docs/*.md') )
unset IFS
files=("${src[@]}" "${docs[@]}")
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
echo 'Congratulations! All Go source files and docs have been checked for common mispellings.'
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