Files
huskies/script/check
T

22 lines
1.0 KiB
Bash
Raw Normal View History

2026-04-29 13:24:10 +00:00
#!/usr/bin/env bash
2026-05-13 14:38:55 +00:00
# Pre-commit quality gate: fmt-check, clippy, cargo check, and doc-coverage.
# Run this before committing to catch fmt drift, clippy warnings, compile
# errors, and missing doc comments without waiting for the full test suite.
2026-04-29 13:24:10 +00:00
set -euo pipefail
2026-05-13 14:38:55 +00:00
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
echo "=== Checking Rust formatting ==="
cargo fmt --manifest-path "$PROJECT_ROOT/Cargo.toml" --all --check
echo "=== Running cargo clippy ==="
cargo clippy --manifest-path "$PROJECT_ROOT/Cargo.toml" --workspace --all-targets -- -D warnings
echo "=== Regenerating source map ==="
cargo run --manifest-path "$PROJECT_ROOT/Cargo.toml" -p source-map-gen --bin source-map-regen --quiet -- --project-root "$PROJECT_ROOT"
git -C "$PROJECT_ROOT" add .huskies/source-map.json
2026-05-13 14:38:55 +00:00
echo "=== Checking doc coverage on changed files ==="
cargo run --manifest-path "$PROJECT_ROOT/Cargo.toml" -p source-map-gen --bin source-map-check --quiet -- --worktree "$PROJECT_ROOT" --base master