Skip to content

fix: adopt ruff 0.16 defaults and pin the version CI installs - #47

Merged
lezama merged 1 commit into
trunkfrom
fix/pin-ruff-and-sort-imports
Aug 4, 2026
Merged

fix: adopt ruff 0.16 defaults and pin the version CI installs#47
lezama merged 1 commit into
trunkfrom
fix/pin-ruff-and-sort-imports

Conversation

@lezama

@lezama lezama commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What

CI's "Python lint, types, tests" job went red on every open PR (#45, #46) over files those PRs never touched. Cause: the dev extra declares ruff>=0.6 unpinned, CI installs latest on each run, and ruff 0.16 changed its default rule set.

Fix

  • Pin ruff>=0.16,<0.17 so lint results are deterministic; future default-set changes land as deliberate bumps, not surprise CI breakage.
  • Apply the 0.16 autofixes (import sorting, modern typing syntax) across the harness — mechanical, no behavior change (26 files, all green under pytest/mypy).
  • Exempt typer.Option from B008 (flake8-bugbear.extend-immutable-calls): typer's call-in-default pattern is its documented API.
  • Fix the four genuine findings the new rules caught: useless conditional in cli.py, dict() call → literal in a test, result-file timestamps now explicitly UTC (timezone-independent artifact names), and an intentional broad except in cost estimation annotated with its rationale.

Verification

ruff check python clean under 0.16.1, mypy python clean, 152 tests pass.

Once merged, #45 and #46 just need a CI re-run (the lint job runs on the merge ref) — no rebase strictly required.

🤖 Generated with Claude Code

CI installs ruff unpinned (dev = ruff>=0.6) and ruff 0.16 changed the
default rule set, turning every open PR red on files they never touched
(import sorting plus new default rules).

- Pin dev tooling to ruff>=0.16,<0.17 so CI is deterministic and a
  future default-set change cannot break unrelated PRs again.
- Apply the 0.16 autofixes across the harness (import sorting, modern
  typing syntax) — mechanical, no behavior change.
- Exempt typer.Option from B008 via flake8-bugbear extend-immutable-
  calls: typer declares CLI options through call defaults by design.
- Fix the four genuine new-rule findings: a useless conditional in
  cli.py (RUF034), a dict() call rewritten as a literal (C408), the
  result-file timestamp now uses UTC explicitly (DTZ005) so artifact
  names are timezone-independent, and the deliberate best-effort
  broad catch in cost estimation is annotated (BLE001).

ruff check, mypy, and the full pytest suite are green under 0.16.1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: lezama <migueluy@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@lezama
lezama merged commit ae0f29e into trunk Aug 4, 2026
5 checks passed
@lezama
lezama deleted the fix/pin-ruff-and-sort-imports branch August 4, 2026 20:58
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.

1 participant