style: Add extended Ruff rules from Scientific Python repo review#2688
style: Add extended Ruff rules from Scientific Python repo review#2688
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2688 +/- ##
==========================================
+ Coverage 98.15% 98.18% +0.02%
==========================================
Files 65 65
Lines 4227 4289 +62
Branches 472 461 -11
==========================================
+ Hits 4149 4211 +62
- Misses 47 48 +1
+ Partials 31 30 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adopts the scientific-python cookie extended rule set, adding: ARG, BLE, C4, DTZ, EM, EXE, FA, FLY, FURB, G, ICN, ISC, LOG, NPY, PD, PERF, PGH, PIE, PL, PT, PTH, PYI, Q, RET, RSE, SIM, SLOT, T10, T20, TC, TRY, YTT Per-file T20 ignores for notebooks, tests, noxfile, and validation scripts where print is legitimate. PLC0415, TC001, TC003 ignored pending further review. PLR09, PLR2004 ignored per convention. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dacab57 to
85c204e
Compare
There was a problem hiding this comment.
I'm going to review this later given that it is massive and is going to have a lot of repeated things, but Claude Code decided to abandon f-string use for some reason which I do not want to do unless there is a very strong reason for it.
I marked two revision areas but it happens a lot more.
To be clear, I love this PR in general though. :D
| click.echo("\n".join(file_list)) | ||
| except AttributeError: | ||
| log.error( | ||
| log.exception( |
There was a problem hiding this comment.
Shouldn't this still be an error? What rule is moving it to exception?
There was a problem hiding this comment.
There was a problem hiding this comment.
Thanks @kratsg. This is all great. The one thing is that we had previously intentionally kept optimize out of __all__ given user confusion and I think we should keep that.
My suggested changes are probably not the right ones though as I'm assuming that Ruff introduced them all.
matthewfeickert
left a comment
There was a problem hiding this comment.
I pushed my suggested revisions, but please review and revert them if you don't like them. Other than that I'm happy. 👍
This will be a great PR for moving forward contributions where there's small stuff that Ruff can handle for us now!
* Apply Ruff rules ARG001, F401, F811, F821, F841, NPY002, PERF401, PTH123, SIM115 for notebooks. * Amends PR #2688.
Pull Request Description
This PR adds the additional extended rules for
rufffrom scientific-python/cookie: https://github.com/scientific-python/cookie/blob/10e253aaaa7f22418b95d0e446cea216acd4d5a7/%7B%7Bcookiecutter.project_name%7D%7D/pyproject.toml#L284-L329 .The notebooks and validation code need updating / additional love.
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: