-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Update ruff to 0.2.0 #28593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ruff to 0.2.0 #28593
Conversation
This release deprecated some locations for settings, and moved them into different TOML tables.
And also fix a whitespace linting error (E221) in it.
These are the ones we were using with flake8, but were not available before ruff 0.2.0 (or at least whatever the last tested version was). Also, clean up a bit of the code so that we only use one type of whitespace exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the policy issue which I do not feel senior enough to say something about, this makes sense.
(I guess we may want to use ruff in pre-commit as well in the (near) future?)
'spy': 'if isinstance(__ret, cm.ScalarMappable): sci(__ret) # noqa', | ||
'spy': ( | ||
'if isinstance(__ret, cm.ScalarMappable):\n' | ||
' sci(__ret)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just confirming that this looks over indented because the parent has a layer of indentation applied to it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the if
gets inserted at a 1-indent level already. The real change here is removing the noqa
; since we run black
on these auto-generated lines, the result in pyplot.py
is no longer an if+code on a single line regardless of how it is written here.
The new line here is just for consistency for readers of this file.
PR summary
Note, this release is from Feb 1 of this year, which is only 5.5 months ago, but as we don't document it, nor include it anywhere in requirements, it's only for developers "in the know", so I think using something ~6 months out might be okay? Otherwise, we can wait a little while longer.
This release deprecated some locations for settings, and moved them into different TOML tables.
This release also contains 'preview' linting for the whitespace-related checks that we were waiting on. Enabling these checks required copying some exceptions from
.flake8
, and I also tweaked some code so that it only required one exception, instead of some files requiringE201
, and someE221
. If we want to enable the remaining rules,E302
was added in 0.2.2 (Feb 17), butE122
is still not supported.I also cleaned up the F401 warnings, as for those ruff requires an actual code on the
noqa
.PR checklist