Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions dev-scripts/check-python
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ find . \

# Run unit tests and calculate code coverage.
# Load module `app.log` to initialize our custom logger.
coverage run \
./venv/bin/coverage run \
--source app/ \
--omit '*_test.py' \
--module \
unittest discover --pattern '*_test.py' \
app.log
coverage report
./venv/bin/coverage report

# Check for Python init files.
INIT_FILES_OK=true
Expand All @@ -47,7 +47,14 @@ done < <(
"${INIT_FILES_OK}" || exit 1

# Check that source has correct formatting.
yapf --diff --recursive ./
./venv/bin/yapf \
--diff \
--recursive \
./

# Run static analysis for Python bugs/cruft.
./venv/bin/ruff check \
./

# Gather names of all Python scripts in the scripts/ folder.
PYTHON_SCRIPTS=()
Expand All @@ -56,13 +63,8 @@ while read -r line; do
done < <(grep --recursive --files-with-matches '^#!.*python' scripts/)
readonly PYTHON_SCRIPTS

# Run static analysis for Python bugs/cruft.
ruff check \
app/ \
"${PYTHON_SCRIPTS[@]}"

# Check for other style violations.
PYTHONPATH='app/' \
pylint \
./venv/bin/pylint \
app/ \
"${PYTHON_SCRIPTS[@]}"