Repository navigation
Bump Ruff 0.16.8 - #13
Conversation
Bumps the wrapped Ruff release from 0.16.0 to 0.16.8. Alpine base image (3.13-alpine3.24) is already current; the codacy/base CircleCI orb version could not be verified (see PR description) so it was left unchanged. While regenerating docs/patterns.json via src/doc_generator.py, the scraper crashed on a new "Rules without codes" table on Ruff's docs site, and separately its removed/preview-rule detection relied on an exact string match against status tooltips that Ruff's docs site no longer uses (it now stamps them with the version, e.g. "Rule has been in preview since 0.16.5"). Fixed both: skip rows without a rule-code id, and match status tooltips by prefix instead of exact string. This correctly excludes ~138 rules currently in preview upstream that were previously leaking into patterns.json even though codacy_ruff.py invokes `ruff check` without `--preview`, so they could never actually produce results. Regenerated docs/patterns.json, docs/description/*, and docs/multiple-tests/all-patterns/patterns.xml accordingly. No new rule prefixes were introduced between 0.16.0 and 0.16.8, so severity_mapping/category_mapping needed no changes, and no previously-enabled pattern was among the removed preview rules. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The previous CircleCI run failed during codacy/checkout_and_version with an SSH handshake error unrelated to this change (the identical checkout step passed cleanly on the prior PR #11). Empty commit to retrigger the pipeline. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
CI blocked by a CircleCI infra issue, not this change. The This is identical on build #130 and #133 (after retrigger), and happens before any of this PR's diff is even fetched — it's failing to All other validation (Docker build, image sanity-check, and |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 6 |
| Duplication | 0 |
AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Pull Request Overview
No merge-blocking code or quality issues were identified, and Codacy reports the PR as up to standards. However, the acceptance criteria depend on generator filtering, regenerated artifacts, installation, Docker, and integration validation that are not covered by automated tests.
About this PR
- Add reproducible automated coverage for uncoded rows, legacy/versioned removed and preview rule filtering, regenerated artifacts, dependency installation, Docker build, and MultipleTests integration validation.
Test suggestions
- Verify requirements.txt and docs/patterns.json consistently report Ruff 0.16.8.
- Run the generator against a table containing a row whose first cell has no id and verify the row is skipped without crashing.
- Verify rows with legacy and versioned removed-rule status titles are excluded.
- Verify rows with legacy and versioned preview-rule status titles are excluded.
- Verify regenerated pattern metadata, descriptions, and XML fixtures exclude the removed/preview rules while retaining stable rules.
- Run dependency installation, Docker build, and MultipleTests integration validation.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify requirements.txt and docs/patterns.json consistently report Ruff 0.16.8.
2. Run the generator against a table containing a row whose first cell has no id and verify the row is skipped without crashing.
3. Verify rows with legacy and versioned removed-rule status titles are excluded.
4. Verify rows with legacy and versioned preview-rule status titles are excluded.
5. Verify regenerated pattern metadata, descriptions, and XML fixtures exclude the removed/preview rules while retaining stable rules.
6. Run dependency installation, Docker build, and MultipleTests integration validation.
TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback
Summary
0.16.0to0.16.8inrequirements.txt(single source of truth per the README's version table).Dockerfile'spython:3.13-alpine3.24base image is already the latest published3.13-alpinetag — no change needed.docs/patterns.json,docs/description/*, anddocs/multiple-tests/all-patterns/patterns.xmlviasrc/doc_generator.py.Scraper bug fix (why the diff is large)
While regenerating docs,
src/doc_generator.pycrashed with anAttributeErroron a new "Rules without codes" section that Ruff's docs site now has (currently one preview-only rule,pytest-fixture-autouse, with no rule-codeidon its table row). Fixed by skipping rows whose first<td>has noid.While fixing that, I found the generator's removed/preview-rule skip logic was already silently broken: it exact-matched status tooltip text
"This rule has been removed"/"Rule is in preview", but Ruff's docs site now stamps these with the version, e.g."Rule was removed in 0.13.0"/"Rule has been in preview since 0.16.5". The literal"Rule is in preview"string doesn't occur anywhere on the current site (verified: 0 exact matches vs. 141 rules using the new format), so no preview rules were being filtered, even though the code's own comment says it should skip them. I changed both checks to prefix-match instead (keeping the old exact strings too, for safety).This correctly removes 138 preview rules from
docs/patterns.json(e.g. severalE1xx/E2xx/E3xxpycodestyle rules,S4xxsuspicious-import rules,B90xbugbear rules) that were previously present. I confirmed this isn't a functional regression:src/codacy_ruff.pyinvokesruff checkwithout--preview, so Ruff itself would never have produced results for these preview rules regardless of whatpatterns.jsonclaimed — they were dead/no-op entries. I also confirmed none of the removed patterns were in theenabled_rulesallow-list as"enabled": true, and none are referenced in thedocs/multiple-tests/*fixtures.Between 0.16.0 and 0.16.8 there were no newly-added stable rule codes, so
severity_mapping/category_mappinginsrc/doc_generator.pyneeded no updates.Suspicious repository content
None found.
Note:
codacy/baseCircleCI orb not bumpedThe README's playbook says to check for a newer
codacy/baseorb version and bump alongside Ruff (as done in prior bumps). I could not verify the latest published version — CircleCI's orb registry page (circleci.com/developer/orbs/orb/codacy/base) is a JS-rendered SPA that returns no version data via fetch, its GraphQL/REST APIs returned 404 for this orb, and there's no accessible source repo viagh. I left.circleci/config.yml's orb pins (codacy/base@13.1.1,codacy/plugins-test@2.0.11) unchanged rather than guess. Happy to bump if someone can confirm the current version.Test plan
pip install -r requirements.txtsucceeds with Ruff 0.16.8python src/doc_generator.pyruns to completion after the scraper fix (previously crashed)docker build -t codacy-ruff:latest .succeedsdocker run --rm -v /tmp/ruff_sample:/src codacy-ruff:latestproduces correct JSON findings (unsorted imports, unused imports)codacy-plugins-testMultipleTests(matching CI'srun_multiple_tests: true) passes locally against the freshly built image: bothall-patternsandwith-config-filefixtures return expected results