-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Re-code flake8-trio and flake8-async rules to match upstream #10416
Re-code flake8-trio and flake8-async rules to match upstream #10416
Conversation
This is mostly done, except for the previous ASYNC101 and ASYNC102 which don't exactly match any the of the new ASYNC rules. The closest matches are ASYNC220 and ASYNC222, but the behaviors don't match exactly. Part of the problem is that the previous rules should be split into multiple rules (this is easy). The other problem which I'm not sure how to resolve is that it doesn't seem like any of the new ASYNC rules check for |
|
Ok so I modified the implementation of ASYNC220 and ASYNC222, as well as added ASYNC221 so that the three rules would match the behavior of flake8-async. For now I added a check for time.sleep as part of ASYNC222. |
Oh, I'd missed that we don't check for time.sleep anymore. It's a bad match for ASYNC222, as the recommended replacement is using |
66f14b4
to
bcb1947
Compare
Ok I moved the time.sleep check to a newly created ASYNC251 |
We've just released ASYNC251 upstream, so this is back to matching the merged flake8-async plugin. |
Note that we'll need to add "redirects" for all of these rules, see rule_redirects.rs. See #9756 for example. We may be able to make use of #9691 as well, not sure yet. |
Ok I added redirects for the old TRIO rules. But as mentioned the old ASYNC rules don't directly correspond to new ASYNC rules. |
I've got some comments on the human-friendly rule names you have, and it might be good if we synced them to ease transition between flake8-async and ruff. See python-trio/flake8-async#248 (comment) (I'm sorry we're moving so quickly as of late 😁) |
This PR has some merge conflicts now, anything I can do to help? I'm motivated to add (the new) ASYNC101 to Ruff because of the problems mentioned in the draft PEP 789. |
The main issue is that it's going to be a breaking change for users (e.g., |
@zanieb - let's include this in v0.5.0 since it's starting to cause problems. |
@augustelalande -- I'm happy to take responsibility for resolving any conflicts. |
@charliermarsh I'll do it now. I'm also gonna update the rules with the new names from python-trio/flake8-async#248 (comment) |
Nevermind the last part. Updating all the rule names is a significant effort so should be a separate PR. |
11b9beb
to
bf8ec83
Compare
Okay, I'm done with the rebase and I very much hope I didn't mess anything up. I now need to get a better understanding of the change itself to be able to review it :) |
I'm trying to get my head around over all the changes and are having a hard time. What's unclear to me is:
|
From the chanegelog: |
Okay, I think I now have a good overview of what has changed. I plan on reviewing this PR tomorrow (and hopefully merge). I don't think there's anything we can do about mapping the old Trio to ASYNC
ASYNC rule changes
|
20052db
to
d3d93d7
Compare
I manually tested the redirection rules and it all looks good. Let's merge this. |
I think one nice follow up after the release would be to rename the rules to match the upstream names. |
Co-authored-by: Micha Reiser <[email protected]>
Co-authored-by: Micha Reiser <[email protected]>
Summary
Re-code flake8-trio and flake8-async rules to match upstream. Resolves #10303.
TRIO
rulesTRIO
has been renamed toASYNC1
TRIO100
->ASYNC100
TRIO105
->ASYNC105
TRIO109
->ASYNC109
TRIO110
->ASYNC110
TRIO115
->ASYNC115
ASYNC
rulesASYNC116
unchangedASYNC100..ASYNC102
has been renamed toASYNC2
ASYNC100
moved toASYNC210
,ASYNC101
was split intoASYNC220
,ASYNC221
,ASYNC222
,ASYNC230
, andASYNC251
ASYNC102
was merged intoASYNC220
andASYNC221
Behavior changes
ASYNC210
(previouslyASYNC100
): Now detectsurllib3.request
callsASYNC230
: Now also detects calls toio.open
,io.open_code
Test Plan