chore: add pre-commit config (cargo fmt + hygiene at commit; clippy at push)#93
Open
emooreatx wants to merge 1 commit into
Open
chore: add pre-commit config (cargo fmt + hygiene at commit; clippy at push)#93emooreatx wants to merge 1 commit into
emooreatx wants to merge 1 commit into
Conversation
…t push) Two-stage layout so daily commit flow stays fast: ## pre-commit stage (`git commit`) Fast checks only (~1s): - `cargo fmt --all -- --check` — mirrors CI's `clippy + fmt` lane - `trailing-whitespace` + `end-of-file-fixer` — generic hygiene - `check-yaml` / `check-toml` / `check-merge-conflict` - `check-added-large-files --maxkb=500` — flags accidental binary commits before they hit the repo ## pre-push stage (`git push`) The slow gate that catches what fmt can't (~30s warm, 90s cold): - `cargo clippy --features "transport-http transport-reticulum pyo3" --all-targets -- -D warnings` Feature set mirrors CI's `clippy + fmt` lane exactly so a local pass guarantees a CI pass on the clippy side. ## Exclude posture Top-level `exclude:` block keeps the hooks from fighting with: - `Cargo.lock` / `*.lock` — tool-managed - `target/` — build cache - `bindings/` — UniFFI-generated Swift / Kotlin / Python FFI shims; regenerated on every uniffi-bindgen run, manual edits get clobbered - `python/*.so` + `__pycache__/` — local `maturin develop` sideeffects - `.github/workflows/*.yml` — GitHub Actions templating breaks plain YAML parsing ## Install ```bash pip install pre-commit pre-commit install --install-hooks --hook-type pre-commit --hook-type pre-push ``` If `git config --get core.hooksPath` returns a non-default value, unset it with `git config --unset-all core.hooksPath` before install — pre-commit refuses to install when an explicit hooksPath is present even if it points at `.git/hooks`. ## Bypass `git commit --no-verify` / `git push --no-verify` — for genuine emergencies only. The local gates mirror CI; bypassing here means fixing the same thing on the PR's CI gauntlet. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two-stage layout so daily commit flow stays fast:
pre-commit stage (
git commit) — ~1scargo fmt --all -- --checktrailing-whitespace+end-of-file-fixercheck-yaml/check-toml/check-merge-conflictcheck-added-large-files --maxkb=500pre-push stage (
git push) — ~30s warmcargo clippy --features "transport-http transport-reticulum pyo3" --all-targets -- -D warningsFeature set mirrors CI's
clippy + fmtlane exactly — a local pre-push pass guarantees a CI pass on the clippy side.Exclude posture
Top-level
exclude:block keeps the hooks from fighting with:Cargo.lock,target/,bindings/(UniFFI-generated FFI shims regenerated byuniffi-bindgen),python/*.so+__pycache__/(localmaturin developsideeffects),.github/workflows/*.yml(GitHub Actions templating breaks plain YAML parsing).Install
If
git config --get core.hooksPathreturns a non-default value, unset it withgit config --unset-all core.hooksPathbefore install — pre-commit refuses to install when an explicit hooksPath is present even if it points at.git/hooks.Bypass
git commit --no-verify/git push --no-verify— emergency only. The local gates mirror CI, so a hook failure means the PR's CI gauntlet will fail too.Test plan
pre-commit run --all-filespasses on the current tree (after exclude tuning)pre-commit run --hook-stage pre-push --all-filespasses (clippy clean)pre-commit install --install-hooks --hook-type pre-commit --hook-type pre-pushworks on a fresh clone🤖 Generated with Claude Code