From d011f4ba47737ba42ac17c205af70c279f25a28e Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Wed, 15 Jan 2025 18:27:25 +0900 Subject: [PATCH] Draft: [infra] Remove .FORMATDENY file This commit removes .FORMATDENY file. It uses .yapfignore file to ignore yapf formatting and DisableFormat option for clang-format formatting. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- .yapfignore | 3 +++ compiler/ann-api/include/.FORMATDENY | 0 compiler/ann-api/include/.clang-format | 1 + compiler/ann-ref/.FORMATDENY | 0 compiler/ann-ref/.clang-format | 1 + infra/command/format | 17 ----------------- onert-micro/externals/.FORMATDENY | 0 onert-micro/externals/.clang-format | 1 + runtime/3rdparty/.FORMATDENY | 0 runtime/3rdparty/.clang-format | 1 + tests/nnapi/bridge/include/.clang-format | 1 + tests/nnapi/src/.FORMATDENY | 0 tests/nnapi/src/.clang-format | 1 + 13 files changed, 9 insertions(+), 17 deletions(-) create mode 100644 .yapfignore delete mode 100644 compiler/ann-api/include/.FORMATDENY create mode 100644 compiler/ann-api/include/.clang-format delete mode 100644 compiler/ann-ref/.FORMATDENY create mode 100644 compiler/ann-ref/.clang-format delete mode 100644 onert-micro/externals/.FORMATDENY create mode 100644 onert-micro/externals/.clang-format delete mode 100644 runtime/3rdparty/.FORMATDENY create mode 100644 runtime/3rdparty/.clang-format create mode 100644 tests/nnapi/bridge/include/.clang-format delete mode 100644 tests/nnapi/src/.FORMATDENY create mode 100644 tests/nnapi/src/.clang-format diff --git a/.yapfignore b/.yapfignore new file mode 100644 index 00000000000..98f874a5f9b --- /dev/null +++ b/.yapfignore @@ -0,0 +1,3 @@ +runtime/3rdparty/**/* +tests/nnapi/nnapi_test_generator/**/* +tests/nnapi/specs/**/* diff --git a/compiler/ann-api/include/.FORMATDENY b/compiler/ann-api/include/.FORMATDENY deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/ann-api/include/.clang-format b/compiler/ann-api/include/.clang-format new file mode 100644 index 00000000000..e3845288a2a --- /dev/null +++ b/compiler/ann-api/include/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/compiler/ann-ref/.FORMATDENY b/compiler/ann-ref/.FORMATDENY deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/compiler/ann-ref/.clang-format b/compiler/ann-ref/.clang-format new file mode 100644 index 00000000000..e3845288a2a --- /dev/null +++ b/compiler/ann-ref/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/infra/command/format b/infra/command/format index 7255360ff13..2e8338cf486 100644 --- a/infra/command/format +++ b/infra/command/format @@ -3,7 +3,6 @@ INVALID_EXIT=0 FILES_TO_CHECK=() DIRECTORIES_TO_BE_TESTED=() -DIRECTORIES_NOT_TO_BE_TESTED=() DEFAULT_CLANG_VERSION="16" CLANG_FORMAT_CANDIDATE=clang-format-$DEFAULT_CLANG_VERSION PATCH_FILE=format.patch @@ -124,16 +123,9 @@ function check_cpp_files() { # Check c++ files: replace ' ' with newline, check with grep FILES_TO_CHECK_CPP=`echo "$FILES_TO_CHECK" | tr ' ' '\n' | egrep '((\.c[cl]?)|(\.cpp)|(\.h(pp)?))$'` - # Manually ignore style checking - FILES_TO_CHECK_CPP=`echo "$FILES_TO_CHECK_CPP" | egrep -v '((/NeuralNetworks\.h)|(/NeuralNetworksExtensions\.h))$'` # Transform to array FILES_TO_CHECK_CPP=($FILES_TO_CHECK_CPP) - # Skip by '.FORMATDENY' file - for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do - FILES_TO_CHECK_CPP=(${FILES_TO_CHECK_CPP[*]/$s*/}) - done - if [[ ${#FILES_TO_CHECK_CPP} -ne 0 ]]; then ${CLANG_FORMAT} -i ${FILES_TO_CHECK_CPP[@]} EXIT_CODE=$? @@ -166,11 +158,6 @@ function check_python_files() { # Exceptional case: fm-equalize doesn't have '.py' extension. FILES_TO_CHECK_PYTHON+=(`echo "$FILES_TO_CHECK" | tr ' ' '\n' | egrep '^compiler/fm-equalize/fm-equalize$'`) - for s in ${DIRECTORIES_NOT_TO_BE_TESTED[@]}; do - skip=${s#'.'/}/ - FILES_TO_CHECK_PYTHON=(${FILES_TO_CHECK_PYTHON[*]/$skip*/}) - done - if [[ ${#FILES_TO_CHECK_PYTHON} -ne 0 ]]; then yapf -i ${FILES_TO_CHECK_PYTHON[@]} EXIT_CODE=$? @@ -215,10 +202,6 @@ if [[ "${CHECK_DIFF_ONLY}" = "1" ]]; then fi fi -for DIR_NOT_TO_BE_TESTED in $(git ls-files -co --exclude-standard '*/.FORMATDENY'); do - DIRECTORIES_NOT_TO_BE_TESTED+=($(dirname "${DIR_NOT_TO_BE_TESTED}")) -done - check_newline check_permission check_cpp_files diff --git a/onert-micro/externals/.FORMATDENY b/onert-micro/externals/.FORMATDENY deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/onert-micro/externals/.clang-format b/onert-micro/externals/.clang-format new file mode 100644 index 00000000000..e3845288a2a --- /dev/null +++ b/onert-micro/externals/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/runtime/3rdparty/.FORMATDENY b/runtime/3rdparty/.FORMATDENY deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/runtime/3rdparty/.clang-format b/runtime/3rdparty/.clang-format new file mode 100644 index 00000000000..e3845288a2a --- /dev/null +++ b/runtime/3rdparty/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/tests/nnapi/bridge/include/.clang-format b/tests/nnapi/bridge/include/.clang-format new file mode 100644 index 00000000000..e3845288a2a --- /dev/null +++ b/tests/nnapi/bridge/include/.clang-format @@ -0,0 +1 @@ +DisableFormat: true diff --git a/tests/nnapi/src/.FORMATDENY b/tests/nnapi/src/.FORMATDENY deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/tests/nnapi/src/.clang-format b/tests/nnapi/src/.clang-format new file mode 100644 index 00000000000..e3845288a2a --- /dev/null +++ b/tests/nnapi/src/.clang-format @@ -0,0 +1 @@ +DisableFormat: true