Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 5 commits into from
Jul 24, 2024
Merged

Update ruff to 0.2.0 #28593

merged 5 commits into from
Jul 24, 2024

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Jul 19, 2024

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 requiring E201, and some E221. If we want to enable the remaining rules, E302 was added in 0.2.2 (Feb 17), but E122 is still not supported.

I also cleaned up the F401 warnings, as for those ruff requires an actual code on the noqa.

PR checklist

QuLogic added 2 commits July 18, 2024 23:47
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.
@github-actions github-actions bot added topic: geometry manager LayoutEngine, Constrained layout, Tight layout topic: widgets/UI topic: contour labels Jul 19, 2024
Copy link
Member

@oscargus oscargus left a 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)'
Copy link
Member

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?

Copy link
Member Author

@QuLogic QuLogic Jul 24, 2024

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.

@tacaswell tacaswell added this to the v3.10.0 milestone Jul 24, 2024
@ksunden ksunden merged commit 9c69c32 into matplotlib:main Jul 24, 2024
37 of 40 checks passed
@QuLogic QuLogic deleted the ruff-update branch July 24, 2024 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants