Skip to content

chore: add pre-commit config (cargo fmt + hygiene at commit; clippy at push)#93

Open
emooreatx wants to merge 1 commit into
mainfrom
edge-pre-commit-config
Open

chore: add pre-commit config (cargo fmt + hygiene at commit; clippy at push)#93
emooreatx wants to merge 1 commit into
mainfrom
edge-pre-commit-config

Conversation

@emooreatx

Copy link
Copy Markdown
Contributor

Two-stage layout so daily commit flow stays fast:

pre-commit stage (git commit) — ~1s

  • cargo fmt --all -- --check
  • trailing-whitespace + end-of-file-fixer
  • check-yaml / check-toml / check-merge-conflict
  • check-added-large-files --maxkb=500

pre-push stage (git push) — ~30s warm

  • cargo clippy --features "transport-http transport-reticulum pyo3" --all-targets -- -D warnings

Feature set mirrors CI's clippy + fmt lane 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 by uniffi-bindgen), python/*.so + __pycache__/ (local maturin develop sideeffects), .github/workflows/*.yml (GitHub Actions templating breaks plain YAML parsing).

Install

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 — 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-files passes on the current tree (after exclude tuning)
  • pre-commit run --hook-stage pre-push --all-files passes (clippy clean)
  • Install via pre-commit install --install-hooks --hook-type pre-commit --hook-type pre-push works on a fresh clone

🤖 Generated with Claude Code

…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>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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