File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ cd dapi
4242pip install -e .
4343```
4444
45+ ### Set up pre-commit hook
46+
47+ The repo includes a pre-commit hook that auto-formats with ` ruff format ` and blocks commits that fail ` ruff check ` :
48+
49+ ``` bash
50+ cp scripts/pre-commit .git/hooks/pre-commit
51+ chmod +x .git/hooks/pre-commit
52+ ```
53+
4554## Update
4655
4756``` bash
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # Auto-format and lint with ruff before committing
3+ ruff format . 2> /dev/null || .venv/bin/ruff format .
4+ git add -u
5+
6+ # Lint check — blocks commit on failure
7+ if ruff check . 2> /dev/null; then
8+ exit 0
9+ elif .venv/bin/ruff check . 2> /dev/null; then
10+ exit 0
11+ else
12+ echo " "
13+ echo " Commit blocked: ruff check found errors. Fix them and try again."
14+ exit 1
15+ fi
You can’t perform that action at this time.
0 commit comments