Skip to content

ci: run typos in the Rust pre-push hook - #12915

Merged
zkochan merged 1 commit into
mainfrom
ci/pre-push-typos
Jul 10, 2026
Merged

zkochan merged 1 commit into
mainfrom
ci/pre-push-typos

Conversation

@zkochan

@zkochan zkochan commented Jul 10, 2026 •

Copy link
Copy Markdown
Member

Spelling was the only Rust CI gate with no local counterpart in the pre-push hook, so typos surfaced for the first time in CI (as happened on #12913). This adds a typos pnpm pnpr block to pnpm/scripts/pre-push-rust.sh mirroring the "Rust CI / Spell Check" job in pacquet-ci.yml (same target dirs), with the same skip-if-not-installed behavior as the dylint and taplo checks — just init already installs typos-cli. Contributor docs updated to match.

Verified locally with the same typos version CI pins (v1.47.2): clean run on the current tree.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added spelling checks to the Rust pre-push validation process.
    • Pushes with spelling errors are blocked when the spelling tool is available.
  • Documentation

    • Updated setup instructions to describe the spelling check, tool discovery, and behavior when required tools are unavailable.

Spelling was the only Rust CI gate with no local counterpart in the
pre-push hook, so typos surfaced for the first time in CI. Add a typos
block mirroring the "Rust CI / Spell Check" job (same dirs), with the
same skip-if-not-installed behavior as the dylint and taplo checks —
`just init` already installs typos-cli.

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI review requested due to automatic review settings July 10, 2026 16:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 950820f5-619f-415d-8598-09c3245f3d23

📥 Commits

Reviewing files that changed from the base of the PR and between 8e17c3d and 2739c21.

📒 Files selected for processing (3)
  • CONTRIBUTING.md
  • pnpm/CONTRIBUTING.md
  • pnpm/scripts/pre-push-rust.sh

📝 Walkthrough

Walkthrough

The Rust pre-push hook now optionally runs typos pnpm pnpr, fails on spelling errors, and reports when the tool is unavailable. Contributor documentation updates describe this check and its PATH-based discovery behavior.

Changes

Rust pre-push spelling validation

Layer / File(s) Summary
Add typos gate and document setup
pnpm/scripts/pre-push-rust.sh, CONTRIBUTING.md, pnpm/CONTRIBUTING.md
The hook adds conditional spelling validation and updated comments; contributor instructions list typos alongside the existing Rust checks and explain missing-tool behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • pnpm/pnpm#12035: Introduces the Rust pre-push hook that this change extends with a spelling check.

Suggested labels: product: pacquet

Suggested reviewers: qodo-code-review

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/pre-push-typos

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Run typos spell check in the Rust pre-push hook

✨ Enhancement 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Add a local typos spell-check step to the Rust pre-push hook, matching CI scope.
• Keep consistent “skip if tool missing” behavior to avoid blocking contributors.
• Update contributor docs to reflect the new pre-push spelling gate.
Diagram

graph TD
  Dev(("Developer")) --> Husky[".husky/pre-push"] --> Script["pre-push-rust.sh"] --> Existing["Existing Rust checks\n(fmt/doc/dylint/taplo)"]
  Script --> TyposOnPath{"typos on PATH?"}
  TyposOnPath -->|"yes"| RunTypos["typos pnpm pnpr"] --> TyposCfg[".typos.toml"]
  TyposOnPath -->|"no"| SkipTypos["Skip spell check"]

  subgraph Legend
    direction LR
    _actor(("Actor")) ~~~ _step["Step"] ~~~ _decision{"Decision"}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Make typos mandatory (fail if missing)
  • ➕ Ensures local runs always match CI behavior
  • ➕ Avoids contributors unknowingly skipping spelling checks
  • ➖ Can block new contributors who haven’t run just init yet
  • ➖ Inconsistent with current pre-push philosophy for other optional tools (taplo/dylint)
2. Run typos via a single unified task (e.g., `just pre-push` or `pnpm lint:rust`)
  • ➕ Centralizes all local gates under one explicit command
  • ➕ Easier to reuse in CI and editor integrations
  • ➖ Doesn’t prevent typos from reaching CI unless developers remember to run it
  • ➖ More repo-wide wiring than needed for this small parity fix

Recommendation: The PR’s approach is the best fit: it mirrors the CI spell-check scope (typos pnpm pnpr) and matches existing pre-push ergonomics by skipping when the tool is not installed. The main alternative—hard-failing when typos is missing—would increase enforcement but would be a behavior change compared to the existing optional-tool checks.

Files changed (3) +14 / -3

Documentation (2) +2 / -2
CONTRIBUTING.mdDocument typos as part of Rust pre-push checks +1/-1

Document typos as part of Rust pre-push checks

• Updates the root contributor guide to list 'typos' among the Rust checks executed by the husky pre-push hook and among tools resolved via PATH.

CONTRIBUTING.md

CONTRIBUTING.mdUpdate pnpm contributor docs to include typos in pre-push +1/-1

Update pnpm contributor docs to include typos in pre-push

• Adjusts the pnpm contributor documentation to reflect that 'pre-push-rust.sh' now runs 'typos' in addition to existing Rust checks.

pnpm/CONTRIBUTING.md

Other (1) +12 / -1
pre-push-rust.shAdd optional typos spell check mirroring CI targets +12/-1

Add optional typos spell check mirroring CI targets

• Adds a 'typos pnpm pnpr' step to the Rust pre-push hook, matching the CI spell-check job’s target directories. The check is skipped with a warning when 'typos' is not on PATH, and failures mark the hook as failed with guidance to '.typos.toml'.

pnpm/scripts/pre-push-rust.sh

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 18 rules

Grey Divider


Remediation recommended

1. Hook checks misdocumented 🐞 Bug ⚙ Maintainability
Description
The updated contributor docs say the Rust pre-push hook runs only (format, doc, dylint, typos), but
the hook script also runs cargo clippy and taplo format --check, and the “silently skipped …
checks” sentence is now incomplete. This can mislead contributors about what local enforcement
actually covers and which tools must be present on PATH.
Code

CONTRIBUTING.md[63]

+Make sure `~/.cargo/bin` is on your `PATH`, ahead of any system-wide Rust in `/usr/bin`. `rustup`'s installer adds this entry through `~/.cargo/env`; ensure your shell sources it. This matters for the git hooks. The `pnpm install` step above wires up husky, and its `pre-push` hook runs the Rust checks in `pnpm/scripts/pre-push-rust.sh` (format, doc, dylint, typos) alongside the TypeScript compile and lint. That script locates `cargo`, `rustup`, `taplo`, `typos`, and `cargo-dylint` through `PATH`, and it **skips** a check when the tool is not found rather than failing. A push that appears to pass locally with the tools off `PATH` has silently skipped the format, doc, and dylint checks, so those problems surface only in CI.
Evidence
The docs enumerate a subset of checks, while the hook script clearly runs additional commands beyond
that list.

CONTRIBUTING.md[63-63]
pnpm/CONTRIBUTING.md[85-85]
pnpm/scripts/pre-push-rust.sh[11-42]
pnpm/scripts/pre-push-rust.sh[47-66]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`CONTRIBUTING.md` (and `pnpm/CONTRIBUTING.md`) list an incomplete set of checks executed by the Rust pre-push hook. The hook runs `cargo clippy` and `taplo format --check` in addition to `cargo fmt`, `cargo doc`, `cargo dylint`, and now `typos`.

### Issue Context
This PR added `typos` to the pre-push hook and updated the docs, but the docs’ enumerations and the “silently skipped … checks” clause weren’t updated to reflect all checks the hook performs.

### Fix Focus Areas
- CONTRIBUTING.md[63-63]
- pnpm/CONTRIBUTING.md[85-85]
- pnpm/scripts/pre-push-rust.sh[1-66]

### Suggested fix
- Update both docs to list all checks the hook actually runs (at least: fmt, clippy, doc, dylint, typos, taplo), or rephrase to avoid enumerating and instead say “runs Rust checks from pre-push-rust.sh”.
- Update the “silently skipped … checks” sentence to include the full set (or generalize it to “silently skipped one or more checks”).
- Optionally update the header comment in `pre-push-rust.sh` to include clippy and taplo so it matches behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

Auto-approved notes - no code suggestions found
- 'approve_pr_on_self_review' flag enabled

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 10, 2026
@zkochan
zkochan merged commit 78c2245 into main Jul 10, 2026
27 checks passed
@zkochan
zkochan deleted the ci/pre-push-typos branch July 10, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants