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:
parent
f1563c5604
commit
ed2a3f92e0
1 changed files with 16 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue