chore: run cargo fmt, doc, and dylint checks in husky pre-push#12035
Conversation
The Rust workspace's pre-push checks were sitting in `pacquet/.githooks/pre-push` and only fired if a developer ran `just install-hooks`, which would also disable every husky-managed TypeScript hook by replacing `core.hooksPath`. Move the bash logic to `pacquet/scripts/pre-push-rust.sh`, invoke it from `.husky/pre-push` alongside the existing TS compile and lint checks, and drop the `install-hooks` recipe so nobody re-points `core.hooksPath` by mistake. The script now also runs `cargo doc --no-deps --workspace --all-features` (with `RUSTDOCFLAGS=-D warnings`) and `cargo dylint --all -- --all-targets --workspace` (with `RUSTFLAGS=-D warnings`), matching CI. `--workspace` covers both `pacquet/crates/*` and `registry/crates/*` since they share the root Cargo workspace.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR migrates the repository's Git pre-push hook from a manually-installed ChangesPre-push Hook Migration to Husky with Expanded Checks
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review Summary by QodoIntegrate Rust checks into husky pre-push hook with doc and dylint
WalkthroughsDescription• Integrate Rust pre-push checks into husky workflow • Add cargo doc and cargo dylint validation to pre-push hook • Move pre-push logic from .githooks to pacquet/scripts/pre-push-rust.sh • Remove install-hooks recipe and core.hooksPath configuration • Update documentation to reflect new hook setup Diagramflowchart LR
A["Old: .githooks/pre-push<br/>fmt + taplo only"] -->|Migrate| B["New: pacquet/scripts/pre-push-rust.sh<br/>fmt + doc + dylint + taplo"]
C[".husky/pre-push<br/>TypeScript checks"] -->|Call| B
D["justfile<br/>Remove install-hooks"] -->|Simplify| E["husky prepare<br/>Auto-configures hooks"]
B -->|Runtime detection| F["cargo-dylint<br/>optional, skip if missing"]
File Changes1. pacquet/scripts/pre-push-rust.sh
|
Summary
pacquet/.githooks/pre-push, which only ran if someone manually executedjust install-hooks. That recipe setcore.hooksPath = pacquet/.githooks, which also disables every husky-managed TypeScript hook (commit-msg,pre-commit, etc.) — so in practice the script never ran for anyone on a cleanpnpm installsetup.pacquet/scripts/pre-push-rust.shand call it from.husky/pre-pushaftercompile-only+lint --quiet. Drop theinstall-hooksrecipe (and its call frominit) so nobody re-pointscore.hooksPathaway from husky by mistake.cargo doc --no-deps --workspace --all-features(withRUSTDOCFLAGS=-D warnings) andcargo dylint --all -- --all-targets --workspace(withRUSTFLAGS=-D warnings), matching CI.--workspacealready covers bothpacquet/crates/*andregistry/crates/*because they share the root Cargo workspace.cargo-dylintis detected at runtime and skipped with a yellow warning if not installed; cargo / taplo absence is handled the same way the original script did.Migration note
Anyone whose machine ran
just install-hookspreviously hascore.hooksPathpointing at the now-deletedpacquet/.githooks/directory. The nextpnpm installreruns husky'spreparescript and resets the path to.husky/_automatically — no manual fix needed.Test plan
git push --dry-runrunscargo fmt --check,cargo doc, andcargo dylintand fails fast on any warningcargo-dylinton PATH the dylint step prints a yellow skip warning and the push still proceedscargoon PATH all three Rust checks are skipped with a single warning.husky/still fire (commit-msgruns commitlint,pre-commitblocks direct main commits in Claude Code, etc.)Written by an agent (Claude Code, claude-opus-4-7).
Summary by CodeRabbit
Chores
Documentation