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. # 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 # Read arguments
while [[ "$@" ]]; do while [[ "$@" ]]; do
case "$1" in case "$1" in
@ -53,8 +51,11 @@ done
# Check formatting using clang-format # Check formatting using clang-format
if [[ $CHECK_FORMAT ]]; then if [[ $CHECK_FORMAT ]]; then
echo "Checking your code using clang-format..." echo "Checking your code using clang-format..."
if ! diff="$(./clangify.sh --diff --cf-version)"; then diff="$(./clangify.sh --diff --cf-version)"
[[ $? == 1 ]] && cat <<EOM ok=$?
case $ok in
1)
cat <<EOM
*********************************************************** ***********************************************************
*** *** *** ***
*** Your code does not comply with our styleguide. *** *** Your code does not comply with our styleguide. ***
@ -78,10 +79,17 @@ ${diff#*
Exiting... Exiting...
EOM EOM
exit 2 exit 2
else ;;
0)
echo "Thank you for complying with our code standards." echo "Thank you for complying with our code standards."
;;
*)
echo "Something went wrong in our formatting checks: clangify returned $err" >&2
;;
esac
fi fi
fi
set -e
# Setup # Setup
./servatrice/check_schema_version.sh ./servatrice/check_schema_version.sh