Skip to content

Run ruff check in CI with the first group of rule families - #765

Draft
anth-volk wants to merge 3 commits into
ci-scripts-deployfrom
ruff-safe-autofixes
Draft

anth-volk wants to merge 3 commits into
ci-scripts-deployfrom
ruff-safe-autofixes

Conversation

@anth-volk

Copy link
Copy Markdown
Contributor

Fixes #764

Same-Repository Draft PR Check

  • This PR is a draft.
  • This PR is from a branch in PolicyEngine/policyengine-sim-api, not a personal fork.

Summary

Phase 1 step 1.8, group 1 of about 8: safe auto-fixes. Stacked on #763.

  • uv run ruff check . now runs in the lint job on the whole repository, with ruff pinned to 0.15.22.
  • New rule families: ruff.toml adds FLY, FURB, I, PIE, PYI, RET, RSE, UP and W. Every finding is fixed (about 270, mostly import sorting and pyupgrade).
  • Fixed by hand:
    • policyengine-fastapi re-exports JWTDecoder through __all__ and drops two unused imports (the 9 F401s noted in Phase 0).
    • Two executor tests build their JSON receipts with json.dumps instead of % formatting.
    • smoke_app uses min() instead of sorted()[0], so ruff 0.16 (FURB192) is clean too.
    • An unused async with ... as resource was removed.
  • scripts/** is linted as Python 3.11. There's no root pyproject.toml, so it was treated as 3.9. 3.11 is the shared rules tool's minimum, and import sorting now matches policyengine-api byte for byte.
  • Registry: sim.quality.ruff-lint moves from advisory to enforced.

Testing

All seven projects' test suites pass:

Project Passed
fastapi 14
contract 145
observability 30
stage12 12
entry 224
gateway 214
executor 733 (23 skipped)
  • ruff check . passes with 0.15.22 and 0.16.8, and the format check is unchanged.
  • Both guards pass. Rules tool unittest: 75 pass. uv.lock files are unchanged.

🤖 Generated with Claude Code

anth-volk and others added 3 commits October 13, 2026 00:37
Select FLY, FURB, I, PIE, PYI, RET, RSE, UP and W, and fix every finding:
ruff's safe fixes (import sorting, pyupgrade), then by hand:
- policyengine-fastapi re-exports JWTDecoder through __all__ and drops two
  unused imports (the 9 F401s noted in Phase 0).
- Two tests build their JSON receipts with json.dumps, not % formatting.
- smoke_app uses min() rather than sorted()[0] (ruff 0.16 FURB192).
scripts/** is linted as Python 3.11, the shared rules tool's minimum, so
import sorting matches policyengine-api byte for byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lint job now runs ruff check . on the whole repository, and
sim.quality.ruff-lint moves from advisory to enforced with the codes
selected in ruff.toml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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