QGIS/scripts/spell_check/spell_test.sh
Denis Rouzaud 4f3a9f46d2
update Travis to build on Trusty for code layout (#10048)
* update Travis to build on Trusty for code layout

* fix shellcheck replace ! -z by -n

* shellcheck: fix  -n doesn't work with unquoted arguments

* more shellcheck fixes

* use bash instead of posix
2019-05-21 14:13:28 -05:00

26 lines
827 B
Bash
Executable File

#!/usr/bin/env bash
set -e
echo "Spell check"
cd $(git rev-parse --show-toplevel)
if [[ -n $TRAVIS_PULL_REQUEST_BRANCH ]]; then
# if on a PR, just analyze the changed files
echo "TRAVIS PR BRANCH: $TRAVIS_PULL_REQUEST_BRANCH"
FILES=$(git diff --diff-filter=AM --name-only $(git merge-base HEAD ${TRAVIS_BRANCH}) | tr '\n' ' ' )
export PATH=${HOME}/osgeo4travis/bin:${PATH}
elif [[ -n $TRAVIS_COMMIT_RANGE ]]; then
echo "TRAVIS COMMIT RANGE: $TRAVIS_COMMIT_RANGE"
FILES=$(git diff --diff-filter=AM --name-only ${TRAVIS_COMMIT_RANGE/.../..} | tr '\n' ' ' )
export PATH=${HOME}/osgeo4travis/bin:${PATH}
else
echo "Running spell test on all files (might take a while)"
FILES=""
fi
if [[ -n $FILES ]]; then
DIR=$(git rev-parse --show-toplevel)/scripts/spell_check
${DIR}/check_spelling.sh -r $FILES
fi