Skip to content

Commit 476ac27

Browse files
committed
style: simplify static analysis of python files
1 parent fb29908 commit 476ac27

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

.github/workflows/python_test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,9 @@ jobs:
3636
run: |
3737
poetry install --with dev
3838
39-
- name: Lint with ruff
40-
run: |
41-
poetry run ruff check
42-
4339
- name: Run liter
4440
run: |
45-
./check_all_python_scripts.sh
41+
./check_all_python_files.sh
4642
4743
- name: Install language dependencies
4844
working-directory: ${{github.workspace}}/system_setup_scripts
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -euo pipefail
44

5+
poetry run ruff check .
6+
poetry run mypy .
57
poetry run bandit -c bandit.yml -r .
68

79
find . -name "*.py" -not -path "./tests/example_data/python3/*" -exec ./check_python_file.sh {} +

check_python_file.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ declare -i exit_code=0
77
for cur_file in "$@"
88
do
99
printf "Checking \"%s\"\n" "${cur_file}"
10-
printf "Checking with pylint:\n"
11-
if ! poetry run pylint "${cur_file}" ; then
10+
pylint_output=$(poetry run pylint "${cur_file}" 2>&1) || {
11+
printf "Checking with pylint:\n%s\n" "${pylint_output}"
1212
exit_code=1
13-
fi
13+
}
1414

15-
printf "Checking with flake8:\n"
16-
if ! poetry run flake8 "${cur_file}" --count --max-line-length=88 --show-source --ignore=E203; then
15+
flake8_output=$(poetry run flake8 "${cur_file}" --count --max-line-length=88 --show-source --ignore=E203,W503 2>&1) || {
16+
printf "Checking with flake8:\n%s\n" "${flake8_output}"
1717
exit_code=1
18-
fi
18+
}
1919

20-
printf "Checking with mypy:\n"
21-
if ! poetry run mypy "${cur_file}"; then
20+
mypy_output=$(poetry run mypy "${cur_file}" 2>&1) || {
21+
printf "Checking with mypy:\n%s\n" "${mypy_output}"
2222
exit_code=1
23-
fi
23+
}
2424
done
2525

2626
if [[ ${exit_code} -eq 0 ]] ; then

0 commit comments

Comments
 (0)