Check format all files as default (#4775)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 18 Mar 2019 09:34:07 +0000 (18:34 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 18 Mar 2019 09:34:07 +0000 (18:34 +0900)
Check format all c and c++ files as default

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
contrib/.FORMATCHECKED [deleted file]
contrib/tflite_classify/.FORMATCHECKED [deleted file]
externals/.FORMATDENY [moved from tools/.FORMATCHECKED with 100% similarity]
include/.FORMATCHECKED [deleted file]
libs/.FORMATCHECKED [deleted file]
runtimes/.FORMATCHECKED [deleted file]
scripts/command/format-check
tests/.FORMATCHECKED [deleted file]

diff --git a/contrib/.FORMATCHECKED b/contrib/.FORMATCHECKED
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/contrib/tflite_classify/.FORMATCHECKED b/contrib/tflite_classify/.FORMATCHECKED
deleted file mode 100644 (file)
index e69de29..0000000
similarity index 100%
rename from tools/.FORMATCHECKED
rename to externals/.FORMATDENY
diff --git a/include/.FORMATCHECKED b/include/.FORMATCHECKED
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/libs/.FORMATCHECKED b/libs/.FORMATCHECKED
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/runtimes/.FORMATCHECKED b/runtimes/.FORMATCHECKED
deleted file mode 100644 (file)
index e69de29..0000000
index fa9bc65..cd9bfaa 100644 (file)
@@ -65,57 +65,43 @@ check_permission() {
 }
 
 check_cpp_files() {
-    DIRECTORIES_TO_BE_TESTED=$1
-    DIRECTORIES_NOT_TO_BE_TESTED=$2
+    DIRECTORIES_NOT_TO_BE_TESTED=$1
 
     # Check c++ files
-    for TEST_DIR in ${DIRECTORIES_TO_BE_TESTED[@]}; do
-        pushd $TEST_DIR
-            CPP_FILES_TO_CHECK=$(git ls-files '*.h' '*.cpp' '*.cc' ':!:NeuralNetworks.h')
-            ARR=($CPP_FILES_TO_CHECK)
-            for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do
-                if [[ $s = $TEST_DIR* ]]; then
-                    skip=${s#$TEST_DIR/}/
-                    ARR=(${ARR[*]//$skip*})
-                fi
-            done
-            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
+    CPP_FILES_TO_CHECK=$(git ls-files '*.h' '*.cpp' '*.cc' ':!:include/NeuralNetworks.h')
+    ARR=($CPP_FILES_TO_CHECK)
+    for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do
+        skip=${s#'.'/}/
+        ARR=(${ARR[*]//$skip*/})
     done
+    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
 }
 
 check_python_files() {
-    DIRECTORIES_TO_BE_TESTED=$1
-    DIRECTORIES_NOT_TO_BE_TESTED=$2
+    DIRECTORIES_NOT_TO_BE_TESTED=$1
 
     # Check python files
-    for TEST_DIR in ${DIRECTORIES_TO_BE_TESTED[@]}; do
-        pushd $TEST_DIR
-            PYTHON_FILES_TO_CHECK=$(git ls-files '*.py')
-            ARR=($PYTHON_FILES_TO_CHECK)
-            for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do
-                if [[ $s = $TEST_DIR* ]]; then
-                    skip=${s#$TEST_DIR/}/
-                    ARR=(${ARR[*]//$skip*})
-                fi
-            done
-            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
+    PYTHON_FILES_TO_CHECK=$(git ls-files '*.py')
+    ARR=($PYTHON_FILES_TO_CHECK)
+    for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do
+        skip=${s#'.'/}/
+        ARR=(${ARR[*]//$skip*/})
     done
+    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
 }
 
 echo "Make sure commit all changes before running this checker."
@@ -123,33 +109,23 @@ echo "Make sure commit all changes before running this checker."
 __Check_CPP=${CHECK_CPP:-"1"}
 __Check_PYTHON=${CHECK_PYTHON:-"1"}
 
-DIRECTORIES_TO_BE_TESTED=()
 DIRECTORIES_NOT_TO_BE_TESTED=()
 
-for DIR_TO_BE_TESTED in $(find -name '.FORMATCHECKED' -exec dirname {} \;); do
-    DIRECTORIES_TO_BE_TESTED+=("$DIR_TO_BE_TESTED")
-done
-
 for DIR_NOT_TO_BE_TESTED in $(find -name '.FORMATDENY' -exec dirname {} \;); do
     DIRECTORIES_NOT_TO_BE_TESTED+=("$DIR_NOT_TO_BE_TESTED")
 done
 
-if [[ ${#DIRECTORIES_TO_BE_TESTED[@]} -eq 0 ]]; then
-    echo "No directories to be checked"
-    return
-fi
-
 check_newline
 check_permission
 
 if [[ $__Check_CPP -ne 0 ]]; then
   check_cpp_tool
-  check_cpp_files $DIRECTORIES_TO_BE_TESTED $DIRECTORIES_NOT_TO_BE_TESTED
+  check_cpp_files $DIRECTORIES_NOT_TO_BE_TESTED
 fi
 
 if [[ $__Check_PYTHON -ne 0 ]]; then
   check_python_tool
-  check_python_files $DIRECTORIES_TO_BE_TESTED $DIRECTORIES_NOT_TO_BE_TESTED
+  check_python_files $DIRECTORIES_NOT_TO_BE_TESTED
 fi
 
 git diff --ignore-submodules > format.patch
diff --git a/tests/.FORMATCHECKED b/tests/.FORMATCHECKED
deleted file mode 100644 (file)
index e69de29..0000000