From 1a7e407b441e85936f91da1d997113e8be697b5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 9 Apr 2019 20:13:01 +0900 Subject: [PATCH] Fix copyright checker (#4954) Rename copyright check script Change mode: remove execution and allow only source (by nnfw command) Exit with exit code when invalid result Signed-off-by: Hyeongseok Oh --- scripts/command/{copyright-checker.sh => copyright-check} | 9 +++++++++ 1 file changed, 9 insertions(+) rename scripts/command/{copyright-checker.sh => copyright-check} (91%) mode change 100755 => 100644 diff --git a/scripts/command/copyright-checker.sh b/scripts/command/copyright-check old mode 100755 new mode 100644 similarity index 91% rename from scripts/command/copyright-checker.sh rename to scripts/command/copyright-check index 9f2201f..9401e69 --- a/scripts/command/copyright-checker.sh +++ b/scripts/command/copyright-check @@ -1,5 +1,7 @@ #!/bin/bash +INVALID_EXIT=0 + check_copyright_year() { DIRECTORIES_NOT_TO_BE_TESTED=$2 YEAR=`date +"%Y"` @@ -30,8 +32,10 @@ check_copyright_year() { if [[ $COPYRIGHT_YEAR != $YEAR ]]; then [[ -z "$COPYRIGHT_YEAR" ]] && COPYRIGHT_YEAR="None" echo "Copyright year of $f is incorrect: expected $YEAR, found $COPYRIGHT_YEAR" + INVALID_EXIT=1 elif ! grep -q "$CORRECT_COPYRIGHT" $f; then echo "Copyright format of $f is incorrect: expected $CORRECT_COPYRIGHT" + INVALID_EXIT=1 fi done fi @@ -44,3 +48,8 @@ for DIR_NOT_TO_BE_TESTED in $(find -name '.FORMATDENY' -exec dirname {} \;); do done check_copyright_year $DIRECTORIES_NOT_TO_BE_TESTED + +if [[ $INVALID_EXIT -ne 0 ]]; then + echo "[FAILED] Invalid copyright check exit." + exit 1 +fi -- 2.7.4