22 lines
1.0 KiB
Bash
Executable File
22 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# 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.
|
|
set -euo pipefail
|
|
|
|
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
|
|
|
|
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
|