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.
|
# 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,11 +79,18 @@ ${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."
|
||||||
fi
|
;;
|
||||||
|
*)
|
||||||
|
echo "Something went wrong in our formatting checks: clangify returned $err" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
./servatrice/check_schema_version.sh
|
./servatrice/check_schema_version.sh
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
|
|
Loading…
Reference in a new issue