summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-05-04 17:16:17 -0500
committerChristian Cleberg <[email protected]>2026-05-04 17:16:17 -0500
commite98e9dd6415b958cc3e38ea8c07e99e4a4311c78 (patch)
tree9577c71862d1e687a3f5a9aad2408e6216bab04f
parent052cd6852c73f5fe4096e1391f9e90c426fb94c6 (diff)
downloadnba-scores-e98e9dd6415b958cc3e38ea8c07e99e4a4311c78.tar.gz
nba-scores-e98e9dd6415b958cc3e38ea8c07e99e4a4311c78.tar.bz2
nba-scores-e98e9dd6415b958cc3e38ea8c07e99e4a4311c78.zip
add pre-push git commit hooks to run ruff check and ruff format
-rwxr-xr-x.githooks/pre-push21
1 files changed, 21 insertions, 0 deletions
diff --git a/.githooks/pre-push b/.githooks/pre-push
new file mode 100755
index 0000000..48b6859
--- /dev/null
+++ b/.githooks/pre-push
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -eu
+
+if ! command -v ruff >/dev/null 2>&1; then
+ echo "pre-push: ruff is not installed or not on PATH" >&2
+ exit 1
+fi
+
+before_status="$(git status --porcelain)"
+
+echo "pre-push: running ruff format"
+ruff format
+
+after_status="$(git status --porcelain)"
+if [ "$before_status" != "$after_status" ]; then
+ echo "pre-push: ruff format changed files; commit the formatting before pushing" >&2
+ exit 1
+fi
+
+echo "pre-push: running ruff check"
+ruff check