Add Ruff rules B018 and UP034 - #1243
Conversation
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1243 +/- ##
==========================================
- Coverage 91.70% 91.70% -0.01%
==========================================
Files 93 93
Lines 5435 5434 -1
Branches 699 700 +1
==========================================
- Hits 4984 4983 -1
Misses 327 327
Partials 124 124
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
looks good. please resolve conflict and i can approve |
…teError on a bare access
…the ruff per-file-ignores
6be607d to
14bbc4d
Compare
|
rebased on main - the only conflict was in pyproject.toml (main dropped the base.py per-file-ignore, this PR drops clark.py's), resolved to drop both. ruff check + format clean on the changed files. |
Summary of Changes
Bundles B018 and UP034 since the cleanup overlaps and you mentioned several rule issues can go in one PR.
B018 (useless-expression) turned up a real bug:
MunichAdjustment.transformbuilds the ldf triangle but hadobj._set_slicerswithout the call, so the returned triangle never rebuilt its.iloc/.loc/.atindexers after the shape change. The rest was test-side - a couple of dead lines, some smoke-check expressions bound to_, and the empty-triangle check inTriangleDisplay._dimensionalityswitched tohasattrinstead of catchingAttributeErroron a bareself.values.UP034 (extraneous-parentheses) was a few redundant paren pairs in
clark.py,benktander.pyand a couple of tests/notebooks.Since touching a file drops its per-file-ignore protection, I cleaned each file I touched to the full ruleset and removed its entry:
clark.py(alsotype(x) ==->isinstanceand a stray assigned lambda ->def),display.py,test_bootstrap.py,test_munich.py.test_development.py,incremental.py,test_voting.pyand two notebooks still trip one of the new rules but are big enough that a full cleanup belongs in its own PR, so they're grandfathered.Related GitHub Issue(s)
Closes #1235
Closes #1236
Additional Context for Reviewers
ruff check + format with both rules is clean over the project apart from the grandfathered files.
pytestpasses for every touched module locally (234 tests).ruff formatdidn't touch any.. testcode::block so the doctest build is unaffected.