Skip to content

chore: add shared git hooks and CONTRIBUTING - #2

Merged
xinyandai merged 1 commit into
mainfrom
chore/git-hooks
Jul 21, 2026
Merged

chore: add shared git hooks and CONTRIBUTING#2
xinyandai merged 1 commit into
mainfrom
chore/git-hooks

Conversation

@xinyandai

Copy link
Copy Markdown
Owner

What

Moves the local git hooks into a tracked .githooks/ directory so they can be shared across clones, and adds CONTRIBUTING.md.

  • .githooks/pre-commit — forbids direct commits to main/master, runs cargo fmt --all --check, and runs cargo clippy --all-features --all-targets -- -D warnings.
  • .githooks/pre-push — runs cargo test --all-features.
  • CONTRIBUTING.md — documents the one-time git config core.hooksPath .githooks setup, what each hook does, the feature-branch/PR workflow, and the CI checks.

Why

Previously the hooks lived in .git/hooks/ (local, not shared on clone). Tracking them in .githooks/ lets every contributor opt in with a single core.hooksPath setting and keeps the local gate in lockstep with CI (fmt, clippy, tests).

Enabling

core.hooksPath is a per-clone local setting (not committed), so each clone runs once:

git config core.hooksPath .githooks

Verification

  • Hooks are committed with the executable bit (100755).
  • The pre-commit hook self-ran on this branch's commit (fmt + clippy) and passed.
  • pre-commit was independently tested to block bad formatting and commits on main; pre-push runs the full suite (24 tests + doctest).

🤖 Generated with Claude Code

Move the pre-commit (main-guard + fmt + clippy) and pre-push (test) hooks into a tracked .githooks/ dir so they can be enabled per-clone via core.hooksPath. Document setup and workflow in CONTRIBUTING.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@xinyandai xinyandai left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r

@xinyandai
xinyandai merged commit 45bc9f1 into main Jul 21, 2026
6 checks passed
@xinyandai
xinyandai deleted the chore/git-hooks branch July 21, 2026 15:07
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