[flake8-pyi] Implement PYI057#11486
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PYI057 | 1 | 1 | 0 | 0 | 0 |
|
Hi! The primary reviewer for this is out right now so it might be a bit slower than usual to get reviewed. Could you change the rule to be in Additionally, I think use of ruff/crates/ruff_python_semantic/src/model.rs Lines 726 to 741 in f79c980 |
|
Welcome to the project :) |
I thought there might be something like this already, but couldn't find it. Thanks! |
There was a problem hiding this comment.
Great to see you around here @tomasr8! :-D Overall this looks great.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
oops didn't notice you already fixed the conflict 😅 |
|
hehe, no worries |
|
Thanks for the review! (as always :D) I removed the The |
AlexWaygood
left a comment
There was a problem hiding this comment.
Thanks very much! Looks great now. I just pushed a couple of nitpick-fixes to your branch :-)
| let semantic = checker.semantic(); | ||
| if !semantic | ||
| .seen | ||
| .intersects(Modules::TYPING | Modules::COLLECTIONS) | ||
| { | ||
| return; | ||
| } |
There was a problem hiding this comment.
@tomasr8: I added this in my latest push. It's an optimisation we do in a lot of rules. It's a very cheap check to see whether any of the relevant modules we care about have been imported at all. If not, we can just short-circuit the rest of the rule :-)
There was a problem hiding this comment.
Ah cool! I'll keep that in mind for future PRs :)
Summary
Adds Y057 from flake8-pyi.
I don't think we can apply any autofix here?
I'm new to rust so apologies in advance if I've made some rookie mistakes 😅
Test Plan
cargo test+cargo insta review