Repository navigation
Add pre-commit: ruff, plus the rendered test templates linted as a sibling would (F11) - #29
Merged
Merged
Conversation
…bling would (F11) The templates hold __PKG__, so ruff excludes templates/; their rendered copies in tests/ are gitignored here, so `ruff check .` skips those too. CI lints them with --no-respect-gitignore since #25, but only after a push. pre-commit now catches it at commit time: - render-shared-tests (local): sync_shared.py --source . --package mcp_shared, when templates/, shared.toml, the sync script or pyproject.toml change. - ruff-check / ruff-format on the staged files, and the same two hooks again (aliases *-rendered-tests) with --no-respect-gitignore tests. Reusing ruff-pre-commit's hooks pins ruff once; a local hook would need its own ruff in additional_dependencies, which Dependabot doesn't update. - pre-commit-hooks: check-toml, check-yaml, check-merge-conflict, end-of-file-fixer, trailing-whitespace (the tree already passes all five). Revs are commit SHAs with "# frozen: vX" comments. Dependabot gains the pre-commit ecosystem (GA 2026-03), which bumps SHA and comment together and skips local hooks. pre-commit joins the dev extra; README and CLAUDE.md say `pre-commit install`. Checked: a 130-column line added to templates/tests/test_tasks.py passes the plain ruff hook and fails both rendered-tests hooks (E501), the #25 failure. Refs #16 Co-Authored-By: Claude Opus 5.5 <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.
Refs #16 (F11).
Why
templates/holds__PKG__, so ruff excludes it. Its rendered copies intests/are gitignored here, soruff check .skips those as well. CI has linted them with--no-respect-gitignoresince #25, but only after a push. This catches the problem at commit time instead.Hooks (
.pre-commit-config.yaml, in run order)pre-commit/pre-commit-hooksv6.0.0render-shared-testspython scripts/sync_shared.py --source . --package mcp_sharedtemplates/,shared.toml, the sync script,pyproject.tomlruff-check,ruff-formatastral-sh/ruff-pre-commitv0.17.4 (= the dev env's ruff)ruff-check-rendered-tests,ruff-format-rendered-testsalias, args--no-respect-gitignore testsThe rendered-tests lint reuses
ruff-pre-commit's hooks rather than a local hook, so ruff is pinned once. A local hook would need ruff inadditional_dependencies, which Dependabot doesn't update: it skips local hooks.Verified. A 130-column line added to
templates/tests/test_tasks.pypasses plainruff checkand fails both rendered-tests hooks with E501. That is exactly the #25 failure.pre-commit run --all-filespasses on this branch.Pinning and Dependabot
# frozen: vXcomments.pre-commitecosystem since 2026-03 (changelog). It bumps the SHA and the comment together. It's added to.github/dependabot.yml, weekly and grouped like the other two ecosystems.Other
pre-commit>=4joins thedevextra.pre-commit install.Note for review
On
main,pytestcan fail locally ontest_no_ipv6_survives_redact(::ffff:0.0.0.1) once hypothesis has drawn it, because the example database replays it. That's the existing flaky test fixed in #28, not this PR.🤖 Generated with Claude Code