Files
musicmouse/scripts/check.sh
Martin Bauer b791beed9c Make mypy run again, fix what it found, and add one check script
a7fb56c pinned mypy to Python 3.11 for the Pi. In a dev venv that also has the
analysis extra, numpy's stubs use 3.12 syntax, so mypy aborted on them before
checking a single file - and from the next day on four real errors went in
unnoticed (ebab03b, 0ef5a04, 9fd106b). Skip following numpy/librosa instead; only
librosa_analyzer.py touches them. Fix the four errors (variables reused with a
narrower type).

There is no CI, so scripts/check.sh is the gate: pytest, ruff, mypy, vitest, tsc
and eslint in one command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 10:49:23 +02:00

45 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Every check this repo has, in one command. There is no CI, so this is the gate:
# run it before committing, and treat a checker that cannot run as a failure.
#
# scripts/check.sh backend and web
# scripts/check.sh backend just one half
# scripts/check.sh web
#
# PYTHON picks the interpreter (default: python-backend/.venv/bin/python, else python3).
set -euo pipefail
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
what="${1:-all}"
backend() {
cd "$repo/python-backend"
local python="${PYTHON:-}"
if [[ -z "$python" ]]; then
if [[ -x .venv/bin/python ]]; then python=.venv/bin/python; else python=python3; fi
fi
echo "== backend: pytest"
"$python" -m pytest -q
echo "== backend: ruff"
"$python" -m ruff check .
echo "== backend: mypy"
"$python" -m mypy
}
web() {
cd "$repo/web"
echo "== web: vitest"
npm run --silent test
echo "== web: tsc + eslint"
npm run --silent check
}
case "$what" in
all) backend; web ;;
backend) backend ;;
web) web ;;
*) echo "usage: $0 [all|backend|web]" >&2; exit 2 ;;
esac
echo "== all checks passed"