Commit e98e9dd641

e98e9dd6415b958cc3e38ea8c07e99e4a4311c78

parent: 052cd6852c

Verified · cmc

cmc <hello@cleberg.net> · 2026-05-04 22:16 UTC

add pre-push git commit hooks to run ruff check and ruff format

Layout: unified · split

.githooks/pre-push added +21
@@ -0,0 +1,21 @@
1#!/bin/sh
2set -eu
3
4if ! command -v ruff >/dev/null 2>&1; then
5 echo "pre-push: ruff is not installed or not on PATH" >&2
6 exit 1
7fi
8
9before_status="$(git status --porcelain)"
10
11echo "pre-push: running ruff format"
12ruff format
13
14after_status="$(git status --porcelain)"
15if [ "$before_status" != "$after_status" ]; then
16 echo "pre-push: ruff format changed files; commit the formatting before pushing" >&2
17 exit 1
18fi
19
20echo "pre-push: running ruff check"
21ruff check