From 0f3a44899cfe625309dea680853897824e4fc4ff Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Fri, 17 Jan 2025 17:22:33 +0900 Subject: [PATCH] [infra] Update python format checker (#14558) This commit updates format checker for python - Use .yapfignore file in root directory instead of .FORMATDENY in each directory to ignore files from yapf - Update yapf version to 0.43.0: update package dependency ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- .github/workflows/check-format.yml | 4 ++-- .yapfignore | 3 +++ infra/command/format | 5 ----- 3 files changed, 5 insertions(+), 7 deletions(-) create mode 100644 .yapfignore diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index 52867d7b414..879fa799dae 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -30,10 +30,10 @@ jobs: python-version: '3.x' # C format: clang-format-16 (already installed) - # Python format: yapf==0.40.2 + # Python format: yapf==0.43.0 - name: Install packages run: | - pip install yapf==0.40.2 + pip install yapf==0.43.0 - name: Check run: ./nnas 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/infra/command/format b/infra/command/format index 7255360ff13..67bb3876d43 100644 --- a/infra/command/format +++ b/infra/command/format @@ -166,11 +166,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=$?