Skip to content

Ruff 0.16 compatibility - #374

Merged
ekiefl merged 11 commits into
mainfrom
ruff-0.16-compat
Aug 2, 2026
Merged

Ruff 0.16 compatibility#374
ekiefl merged 11 commits into
mainfrom
ruff-0.16-compat

Conversation

@ekiefl

@ekiefl ekiefl commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

Bumps ruff 0.15.20 → 0.16.1 and makes the codebase clean under 0.16's expanded default rule set (59 → 413 default rules), which was breaking lint CI on any PR that advanced the lockfile (#369, #372). All 271 new violations are resolved by conforming to the new defaults, with two deliberate exceptions below.

Rule exclusions

  • PLR0402 ignored globally: the import architecture relies on import pooltool.x as x aliasing. The rule's "safe" autofix rewrote these to from pooltool import x, which broke import pooltool outright — the facade's aliased statement order controls package initialization and tolerates the pre-existing system.renderevolution.continuous import cycle via the sys.modules fallback.
  • pooltool/utils/strenum.py excluded from ruff entirely: vendored StrEnum backport, kept byte-faithful to upstream (shielded from both lint and format).

Notable changes beyond mechanical fixes

  • BaseMode.keymap class dicts renamed to default_keymap: ClassVar[...] with instances copying to self.keymap in __init__ (RUF012) — also fixes latent mutation of the shared class dict before the first mode reset.
  • FrictionalInelastic/FrictionalMathavan friction defaults now use attrs.field(factory=AlciatoreBallBallFriction) instead of sharing one mutable instance across resolvers (RUF009).
  • Fixed a no-op test line: pocket.center is copy.center was missing its assert (B015).
  • Removed two vestigial statements surfaced by RUF059 (unused full unpacks of getPos() and cushion.p2).
  • Library modules lost their shebangs/executable bits; sandbox/ scripts kept shebangs and gained the executable bit (EXE001/EXE002/EXE005).
  • The introspect-hotkey pdb.set_trace() is kept as a feature behind noqa: T100; two UI/config boundary catch-alls keep except Exception behind noqa: BLE001 (the psutil catch was instead narrowed to psutil.Error).
  • Timer.timestamp() now returns tz-aware local time (DTZ006); camera errors raise PoolToolError and a bare raise Exception() became a descriptive ValueError (TRY002).
  • __all__ lists are isort-sorted with their grouping comments removed (RUF022).

Validation

  • ruff check . and ruff format --check . clean under 0.16.1
  • Full test suite passes (1301 tests)
  • pyright clean (0 errors)
  • All logical/comparison rewrites (min/max clamps, chained comparisons, boolean collapses, merged branches, assert splits) audited for exact equivalence

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 103c6c7e-7b12-415b-aa56-4d85aeb0cebb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.15385% with 70 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.92%. Comparing base (50ca8a2) to head (badcbbe).

Files with missing lines Patch % Lines
pooltool/ani/modes/datatypes.py 36.36% 7 Missing ⚠️
pooltool/physics/resolve/stronge_compliant.py 14.28% 6 Missing ⚠️
pooltool/ruleset/eight_ball.py 0.00% 5 Missing ⚠️
pooltool/ani/camera/_camera.py 20.00% 4 Missing ⚠️
pooltool/ruleset/snooker/core.py 0.00% 4 Missing ⚠️
pooltool/ani/animate.py 40.00% 3 Missing ⚠️
pooltool/ani/hud.py 25.00% 3 Missing ⚠️
pooltool/ani/modes/aim.py 40.00% 3 Missing ⚠️
pooltool/ani/modes/view.py 40.00% 3 Missing ⚠️
pooltool/objects/cue/render.py 0.00% 3 Missing ⚠️
... and 18 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #374      +/-   ##
==========================================
+ Coverage   47.77%   47.92%   +0.14%     
==========================================
  Files         159      159              
  Lines       10758    10757       -1     
==========================================
+ Hits         5140     5155      +15     
+ Misses       5618     5602      -16     
Flag Coverage Δ
service 47.92% <46.15%> (+0.14%) ⬆️
service-no-ani 58.23% <35.08%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ekiefl
ekiefl merged commit 20b62f6 into main Aug 2, 2026
10 of 12 checks passed
@ekiefl
ekiefl deleted the ruff-0.16-compat branch August 2, 2026 23:31
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