nanobot-voice-interface/scripts/check_python_quality.sh

69 lines
1.5 KiB
Bash
Raw Permalink Normal View History

2026-03-14 20:21:44 -04:00
#!/usr/bin/env bash
set -uo pipefail
status=0
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
python_files=(
"app.py"
"app_dependencies.py"
"card_store.py"
"inbox_service.py"
"message_pipeline.py"
"nanobot_api_client.py"
"route_helpers.py"
"rtc_manager.py"
"session_store.py"
"tool_job_service.py"
"ui_event_bus.py"
"web_runtime.py"
"workbench_store.py"
"routes"
2026-03-14 20:21:44 -04:00
)
run_check() {
local label="$1"
shift
echo "==> ${label}"
if ! "$@"; then
status=1
fi
echo
}
cd "${root_dir}"
run_check \
"Ruff format" \
uv run --with "ruff>=0.15.0,<1.0.0" \
ruff format --check "${python_files[@]}"
run_check \
"Ruff lint" \
uv run --with "ruff>=0.15.0,<1.0.0" \
ruff check "${python_files[@]}"
run_check \
"Deptry" \
uv run --with "deptry>=0.24.0,<1.0.0" \
deptry . \
--requirements-files requirements.txt \
--known-first-party app,card_store,supertonic_gateway,sync_card_templates,voice_rtc,wisper \
2026-03-14 20:21:44 -04:00
--per-rule-ignores DEP002=uvicorn \
--extend-exclude ".*/frontend/.*" \
--extend-exclude ".*/\\.venv/.*" \
--extend-exclude ".*/__pycache__/.*"
run_check \
"Vulture" \
uv run --with "vulture>=2.15,<3.0.0" \
vulture "${python_files[@]}" --min-confidence 80
run_check \
"Card Runtime" \
python3 scripts/check_card_runtime.py
run_check \
"Card Runtime Fixture" \
node scripts/check_card_runtime_fixture.mjs
run_check \
"Backend Tests" \
.venv/bin/python -m unittest discover -s tests -p "test_*.py"
2026-03-14 20:21:44 -04:00
exit "${status}"