Skip to content

Add pre-commit hook to run cargo fmt and clippy checks - #12

Merged
aisrael merged 1 commit into
mainfrom
add-pre-commit-hook
Jul 7, 2026
Merged

Add pre-commit hook to run cargo fmt and clippy checks#12
aisrael merged 1 commit into
mainfrom
add-pre-commit-hook

Conversation

@aisrael

@aisrael aisrael commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a tracked .githooks/pre-commit script that runs cargo fmt -- --check and cargo clippy --all-targets -- -D warnings before every commit, mirroring the checks already gated in CI (.github/workflows/ci.yml).
  • Adds a short note in AGENTS.md explaining that new clones/worktrees need to run git config core.hooksPath .githooks once to activate the hook, since core.hooksPath is a per-clone git config and can't be committed.

Changes

  • .githooks/pre-commit (new, executable) — runs fmt check then clippy, aborting the commit with a clear message if either fails.
  • AGENTS.md — one-line note on enabling the hook via core.hooksPath.

Testing

  • Ran the hook directly (./.githooks/pre-commit) to confirm it passes on a clean tree.
  • Verified git config core.hooksPath is set to .githooks and that git commit invokes the hook.
  • Confirmed the hook blocks a commit when a formatting violation is introduced, and allows a commit through when the tree is clean.
  • Ran cargo fmt -- --check, cargo clippy --all-targets -- -D warnings, and cargo test on this branch — all pass.

Checklist

  • Tests pass
  • Documentation updated (AGENTS.md)
  • No breaking changes

Adds a tracked .githooks/pre-commit script mirroring CI's fmt/clippy
gates, plus an AGENTS.md note on enabling it via core.hooksPath.
@cursor

cursor Bot commented Jul 6, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@aisrael
aisrael merged commit a30674d into main Jul 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant