Spaces:
Sleeping
Sleeping
Download scripts/hooks/pre-commit.sh from defenestrate/learning-world-goliath: direct link, hf CLI and curl.
- Browser
- Download file 742 Bytes
-
https://huggingface.co/spaces/defenestrate/learning-world-goliath/resolve/main/scripts/hooks/pre-commit.sh
- Command line
-
hf download hf://spaces/defenestrate/learning-world-goliath/scripts/hooks/pre-commit.sh
-
curl -L -o pre-commit.sh https://huggingface.co/spaces/defenestrate/learning-world-goliath/resolve/main/scripts/hooks/pre-commit.sh
742 Bytes
| set -e | |
| # Prefer the repo venv: a bare `python` resolves to system Python in normal | |
| # shells and fails collection (no pydantic). Windows venv layout first. | |
| if [ -x ".venv/Scripts/python.exe" ]; then PY=".venv/Scripts/python.exe"; | |
| elif [ -x ".venv/bin/python" ]; then PY=".venv/bin/python"; | |
| else PY="python"; fi | |
| CHANGED=$(git diff --cached --name-only --diff-filter=ACM || true) | |
| CHANGED_PY=$(echo "$CHANGED" | grep '\.py$' || true) | |
| if [ -n "$CHANGED_PY" ]; then "$PY" scripts/guards/no_raw_clients.py $CHANGED_PY; fi | |
| # Mojibake lives in string content, not Python syntax — scan all staged text files. | |
| if [ -n "$CHANGED" ]; then "$PY" scripts/guards/no_mojibake.py $CHANGED; fi | |
| "$PY" -m ruff check . | |
| "$PY" -m pytest -q | |