Skip to content

Commit df35a9f

Browse files
Lewis-Eclaude
andcommitted
chore: add pre-push hook for cargo fmt and clippy
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent b7af312 commit df35a9f

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

.githooks/pre-push

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
echo ">>> [pre-push] Running cargo fmt --check..."
5+
if ! cargo fmt --all -- --check; then
6+
echo ""
7+
echo "HOOK FAILED: cargo fmt check failed."
8+
echo "LLM FIX: run 'cargo fmt --all' then re-attempt the push."
9+
exit 1
10+
fi
11+
12+
echo ">>> [pre-push] Running cargo clippy..."
13+
if ! cargo clippy --all-targets --all-features -- -D warnings; then
14+
echo ""
15+
echo "HOOK FAILED: cargo clippy reported warnings or errors."
16+
echo "LLM FIX: fix the clippy diagnostics above, then re-attempt the push."
17+
exit 1
18+
fi
19+
20+
echo ">>> [pre-push] All checks passed."

0 commit comments

Comments
 (0)