Skip to content

chore: enforce rustfmt in pre-commit and re-format tree - #14

Merged
nshi merged 1 commit into
masterfrom
ning/lint-fixes
Apr 13, 2026
Merged

chore: enforce rustfmt in pre-commit and re-format tree#14
nshi merged 1 commit into
masterfrom
ning/lint-fixes

Conversation

@nshi

@nshi nshi commented Apr 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Base branch target (master for all contributions): master
  • Problem: Pre-commit hook only runs gitleaks; rustfmt drift slips through to pre-push/CI, and the current tree already has fmt drift that cargo fmt --all -- --check rejects.
  • Why it matters: Formatting churn should fail at commit time (cheap, local), not later. The existing pre-push rust_quality_gate.sh is the right home for clippy/tests; pre-commit should own the fast gate.
  • What changed:
    1. .githooks/pre-commit now runs rustfmt --check --edition 2024 against only the staged Rust files, keeping the hook fast on this workspace.
    2. Ran cargo fmt --all across the workspace to clear pre-existing drift so the new gate is green on first run.
  • What did not change (scope boundary): No clippy in pre-commit (stays in pre-push). No CI workflow changes. No logic changes — fmt-only diff across src/, apps/tauri/, tests/.

Adds a fast `cargo fmt --all -- --check` gate to the pre-commit hook
(only triggered when staged files include `.rs`) so style drift fails
locally before reaching pre-push or CI. Heavier clippy/test gates stay
in pre-push.

Also re-runs `cargo fmt --all` across the workspace to clear pre-existing
drift that the gate would otherwise reject on first invocation.

Activate locally with: git config core.hooksPath .githooks
@nshi
nshi merged commit e0165b2 into master Apr 13, 2026
17 checks passed
@nshi
nshi deleted the ning/lint-fixes branch April 13, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant