-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Ruff preview mode #3024
Ruff preview mode #3024
Conversation
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.
I think I'd vote weakly against using ruff preview.
If you just want to run CI checks it's enough to push to a branch in this repo, without opening a PR. (or even better run tests locally ofc)
02bf8b1
to
4061f6a
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3024 +/- ##
==========================================
- Coverage 99.58% 99.58% -0.01%
==========================================
Files 121 121
Lines 18157 18155 -2
Branches 3272 3270 -2
==========================================
- Hits 18082 18080 -2
Misses 52 52
Partials 23 23
|
|
I feel like this is a bug, so astral-sh/ruff#13037 is tracking this.
There are no |
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.
Can we disable RUF029
? We're very deliberate with what is marked async
for trio
and what isn't so nothing should be missed. Tests are a different story but I don't think it matters for them. The false-positives are annoying! (and very noisy. probably like half of the line changes are adding noqa for this!)
Additionally, I don't think A005 brings any benefit. We know we're shadowing stdlib and that's intentional (well, except the underscore prefixed ones, which nobody cares about shadowing anyways).
Co-authored-by: A5rocks <[email protected]>
Co-authored-by: A5rocks <[email protected]>
b3c9dab
to
fe334dc
Compare
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.
Left a few comments because some of the changes involved adding trailing commas. IIRC that's a separate PR? I left a comment on every file with the change rather than on every change.
# A005 is ignoring modules that shadow stdlib modules. | ||
'src/trio/_abc.py' = ['A005'] | ||
'src/trio/_socket.py' = ['A005'] | ||
'src/trio/_ssl.py' = ['A005'] |
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.
Given we're disabling it for all modules it would trigger on, would it make sense to globally ignore 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.
I had the intention of disabling it on current triggers so that in the event a new module was added it would be triggered for the new one. To be honest I don't see that realistically happening any time soon, but that was my logic.
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.
Ah that would make sense. TBH using the built in setting of names to ignore might work with less noise for that case. I'm not sure what would be better.
Co-authored-by: A5rocks <[email protected]>
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.
Everything in my last review seems to be addressed.
I'm not quite sure I like having an explanation with every instance of RUF029
but tbh just seeing that error code doesn't explain much -- I think having different formats of explanations visible at once is getting to me, while it wouldn't while programming (because I would only see a small portion of code).
Going to merge this soon unless anyone has any additional concerns. |
I think it would be good to merge the changes, but perhaps not actually enable |
I think there are a few (like the fstring check rule) that would be nice to have, but maybe that's not worth the churn. |
That is a good point. What if instead, we specifically enabled all of the rules that are preview as of now, and then when new versions come out we can try adding the new ones then? Is it possible to do that with ruff? |
Looks like you can't no. You can specify them, but it won't enable. But we could enable them in preparation. |
My current understanding of conversation is that it would be nice if we could specify which preview rules we would like to enable, but that is not possible as of writing. There was discussion about leaving the changes but not enabling preview mode, which I don't think would be a good solution because first if there are Net result, I will continue with earlier stated merging, and in the event this is not the right course of action we can always revert this or apply a better solution on top of this. |
This pull request enables ruff's preview mode.
Currently a work in progress, but I wanted to see if I've messed anything up in the unit tests.