Skip to content

Commit

Permalink
[infra] Update python format checker (#14558)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
hseok-oh authored Jan 17, 2025
1 parent 66cdc24 commit 0f3a448
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .yapfignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
runtime/3rdparty/**/*
tests/nnapi/nnapi_test_generator/**/*
tests/nnapi/specs/**/*
5 changes: 0 additions & 5 deletions infra/command/format
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down

0 comments on commit 0f3a448

Please sign in to comment.