Skip to content

Bump Ruff 0.16.8 - #13

Merged
heliocodacy merged 2 commits into
masterfrom
chore/automated-tool-update
Sep 24, 2026
Merged

heliocodacy merged 2 commits into
masterfrom
chore/automated-tool-update

Conversation

@stefanvacareanu7

Copy link
Copy Markdown
Contributor

Summary

  • Bumps the wrapped Ruff release from 0.16.0 to 0.16.8 in requirements.txt (single source of truth per the README's version table).
  • Dockerfile's python:3.13-alpine3.24 base image is already the latest published 3.13-alpine tag — no change needed.
  • Regenerated docs/patterns.json, docs/description/*, and docs/multiple-tests/all-patterns/patterns.xml via src/doc_generator.py.

Scraper bug fix (why the diff is large)

While regenerating docs, src/doc_generator.py crashed with an AttributeError on a new "Rules without codes" section that Ruff's docs site now has (currently one preview-only rule, pytest-fixture-autouse, with no rule-code id on its table row). Fixed by skipping rows whose first <td> has no id.

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. several E1xx/E2xx/E3xx pycodestyle rules, S4xx suspicious-import rules, B90x bugbear rules) that were previously present. I confirmed this isn't a functional regression: src/codacy_ruff.py invokes ruff check without --preview, so Ruff itself would never have produced results for these preview rules regardless of what patterns.json claimed — they were dead/no-op entries. I also confirmed none of the removed patterns were in the enabled_rules allow-list as "enabled": true, and none are referenced in the docs/multiple-tests/* fixtures.

Between 0.16.0 and 0.16.8 there were no newly-added stable rule codes, so severity_mapping/category_mapping in src/doc_generator.py needed no updates.

Suspicious repository content

None found.

Note: codacy/base CircleCI orb not bumped

The README's playbook says to check for a newer codacy/base orb 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 via gh. 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.txt succeeds with Ruff 0.16.8
  • python src/doc_generator.py runs to completion after the scraper fix (previously crashed)
  • docker build -t codacy-ruff:latest . succeeds
  • Sanity-checked the image: docker run --rm -v /tmp/ruff_sample:/src codacy-ruff:latest produces correct JSON findings (unsorted imports, unused imports)
  • codacy-plugins-test MultipleTests (matching CI's run_multiple_tests: true) passes locally against the freshly built image: both all-patterns and with-config-file fixtures return expected results
  • CI checks (polling after push)

stefanvacareanu7 and others added 2 commits September 21, 2026 16:17
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>
@stefanvacareanu7

Copy link
Copy Markdown
Contributor Author

CI blocked by a CircleCI infra issue, not this change.

The codacy/checkout_and_version job fails before checking out any code, on both the original push and a retrigger (empty commit), with:

Either git or ssh (required by git to clone through SSH) is not installed in the image. Falling back to CircleCI's native git client...
error cloning repository: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

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 git@github.com:codacy/codacy-ruff.git via SSH at the CircleCI project level. The prior PR (#11) checked out fine with the same orb/config, so this looks like a broken or expired CircleCI checkout SSH key / GitHub integration for this project, not something fixable from the repo. This needs someone with CircleCI project-admin access to re-establish the checkout credentials (e.g. regenerate the deploy key / reconnect the GitHub App) before CI can run here.

All other validation (Docker build, image sanity-check, and codacy-plugins-test MultipleTests) passed locally — see the PR description.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 6 complexity · 0 duplication

Metric Results
Complexity 6
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@heliocodacy
heliocodacy merged commit 6ee0ef5 into master Sep 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants