chore(dev): add pre-commit hooks mirroring the CI lint gate#3
Merged
Conversation
Root cause of the PR #1 CI failure: `ruff format --check` is a separate CI step from `ruff check`, and only the latter was in the documented gate (SPEC §13) and the local routine. Lint-clean code could still fail formatting on CI. - `.pre-commit-config.yaml` — local hooks running `uv run ruff format` and `uv run ruff check --fix`. Using `uv run` (not astral-sh/ruff-pre-commit) means the hook, CI, and the `ruff` dev dependency all resolve to the same ruff, so the hook can't drift from CI. - pyproject: add `pre-commit>=3.5` to the dev extra. - SPEC §13: add `ruff format --check` and `mkdocs build --strict` to the quality-gate list and document the `uv run pre-commit install` step. - README: document the hook in the dev-install section. uv.lock: additive only — pre-commit and its transitive deps (cfgv, distlib, filelock, identify, nodeenv, virtualenv, ...). No runtime dep re-resolved; the large line count is a lock-format `revision` bump from the local uv. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
PR #1 passed local
ruff checkbut failed CI onruff format --check— a separate CI step that wasn't in the documented quality gate (SPEC §13) or the local routine. This closes that gap so formatting issues are caught before they reach CI.What
.pre-commit-config.yaml— local hooks runninguv run ruff formatanduv run ruff check --fix. Usinguv run(rather thanastral-sh/ruff-pre-commit, which pins its own ruff) means the hook, CI, and theruffdev dependency all resolve to the same ruff — no version drift, which is the whole point.pyproject.toml— addpre-commit>=3.5to thedevextra.SPEC.md §13— addruff format --checkandmkdocs build --strictto the quality-gate list (both are CI-enforced but were missing), and documentuv run pre-commit install.README.md— document the hook in the dev-install section.Setup is one command after
uv sync --extra dev:Verification
uv run pre-commit run --all-files: both hooks pass on the whole tree.ruff format --check/ruff checkondocx_plus/ tests/: clean.Note on the
uv.lockdiffThe line count is large but the change is additive only:
pre-commitplus its transitive deps (cfgv,distlib,filelock,identify,nodeenv,virtualenv, …). No runtime dependency was re-resolved (verified: nothing removed from the lock); the bulk of the churn is a lock-formatrevisionbump from the local uv being newer than what generated the original lock.🤖 Generated with Claude Code