ref:3df754cdfacbc228d36b503914cb87c914d30acd

build: add pre-commit hook for cargo fmt + clippy

Version-controlled `.githooks/pre-commit` runs `cargo fmt --all -- --check` and `cargo clippy --all-targets --all-features -- -D warnings` whenever a commit touches any `.rs` file. Non-Rust commits skip the hook and are not slowed down. `scripts/install-hooks.sh` wires `core.hooksPath` to `.githooks` — run once per clone. Zero external dependencies (no pre-commit framework, no husky, no lefthook). Verified: unformatted module change is blocked with a diff and an actionable "run `cargo fmt --all` and re-stage" message. Closes #5
SHA: 3df754cdfacbc228d36b503914cb87c914d30acd
Author: Cole Christensen <cole.christensen@macmillan.com>
Date: 2026-04-20 03:11
Parents: 04c8e1b
2 files changed +37 -0
Type
scripts/install-hooks.sh +13 −0
@@ -1,0 +1,13 @@
#!/usr/bin/env bash
# Wire git hooks to the version-controlled .githooks/ directory.
# Run once per clone.
set -euo pipefail
repo_root=$(git -C "$(dirname "$0")" rev-parse --show-toplevel)
cd "$repo_root"
git config core.hooksPath .githooks
echo "core.hooksPath -> .githooks"
echo "Staged .rs files will now be checked with cargo fmt + clippy before commit."