fix travis format checking again (#3451)

Set the exit code properly, "$?" does not work after "if !".
Move "set -e" to after format checks.
This commit is contained in:
ebbit1q 2018-11-26 01:29:24 +01:00 committed by Zach H
parent f1563c5604
commit ed2a3f92e0

View file

@ -2,8 +2,6 @@
# This script is to be used in .travis.yaml from the project root directory, do not use it from somewhere else.
set -e
# Read arguments
while [[ "$@" ]]; do
case "$1" in
@ -53,8 +51,11 @@ done
# Check formatting using clang-format
if [[ $CHECK_FORMAT ]]; then
echo "Checking your code using clang-format..."
if ! diff="$(./clangify.sh --diff --cf-version)"; then
[[ $? == 1 ]] && cat <<EOM
diff="$(./clangify.sh --diff --cf-version)"
ok=$?
case $ok in
1)
cat <<EOM
***********************************************************
*** ***
*** Your code does not comply with our styleguide. ***
@ -77,12 +78,19 @@ ${diff#*
Exiting...
EOM
exit 2
else
echo "Thank you for complying with our code standards."
fi
exit 2
;;
0)
echo "Thank you for complying with our code standards."
;;
*)
echo "Something went wrong in our formatting checks: clangify returned $err" >&2
;;
esac
fi
set -e
# Setup
./servatrice/check_schema_version.sh
mkdir -p build