Skip to content

Commit 77002a9

Browse files
committed
Add shared pre-commit hook for isort/black
1 parent 5b5e996 commit 77002a9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.githooks/pre-commit

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
# Run Black and isort before each commit to keep formatting consistent.
3+
4+
set -euo pipefail
5+
6+
echo "[pre-commit] Running isort..."
7+
poetry run isort pandasaurus test
8+
9+
echo "[pre-commit] Running black..."
10+
poetry run black pandasaurus test
11+
12+
if ! git diff --quiet --exit-code; then
13+
echo "[pre-commit] Formatting changes were applied. Please review and stage them."
14+
exit 1
15+
fi
16+
17+
echo "[pre-commit] Formatting OK."

0 commit comments

Comments
 (0)