From: 오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Thu, 25 Oct 2018 07:18:43 +0000 (+0900) Subject: Check invalid format-checker exit (#3327) X-Git-Tag: 0.3~525 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38ab61f3201f8d0deebbee1c4249acdcc2cac55b;p=platform%2Fcore%2Fml%2Fnnfw.git Check invalid format-checker exit (#3327) Check invalid format-checker exit and return fail Signed-off-by: Hyeongseok Oh --- diff --git a/scripts/command/format-checker.sh b/scripts/command/format-checker.sh index 989d5fd..9c22067 100755 --- a/scripts/command/format-checker.sh +++ b/scripts/command/format-checker.sh @@ -1,5 +1,7 @@ #!/bin/bash +INVALID_EXIT=0 + pushd () { command pushd "$@" > /dev/null } @@ -62,6 +64,10 @@ check_cpp_files() { CPP_FILES_TO_CHECK=${ARR[*]} if [[ ${#CPP_FILES_TO_CHECK} -ne 0 ]]; then clang-format-3.9 -i $CPP_FILES_TO_CHECK + EXIT_CODE=$? + if [[ $EXIT_CODE -ne 0 ]]; then + INVALID_EXIT=$EXIT_CODE + fi fi popd done @@ -85,6 +91,10 @@ check_python_files() { PYTHON_FILES_TO_CHECK=${ARR[*]} if [[ ${#PYTHON_FILES_TO_CHECK} -ne 0 ]]; then yapf -i --style='{based_on_style: pep8, column_limit: 90}' $PYTHON_FILES_TO_CHECK + EXIT_CODE=$? + if [[ $EXIT_CODE -ne 0 ]]; then + INVALID_EXIT=$EXIT_CODE + fi fi popd done @@ -126,7 +136,7 @@ fi git diff --ignore-submodules > format.patch PATCHFILE_SIZE=$(stat -c%s format.patch) -if [[ -z "${CRCHECK}" ]] && [[ $PATCHFILE_SIZE -eq 0 ]]; then +if [[ -z "${CRCHECK}" ]] && [[ $PATCHFILE_SIZE -eq 0 ]] && [[ $INVALID_EXIT -eq 0 ]]; then echo "[PASSED] Format checker succeed." exit 0 fi @@ -142,4 +152,8 @@ if [[ $PATCHFILE_SIZE -ne 0 ]]; then echo "[FAILED] Format checker failed and update code to follow convention." echo " You can find changes in format.patch" fi + +if [[ $INVALID_EXIT -ne 0 ]]; then + echo "[[FAILED] Invalid format checker exit." +fi exit 1