-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[syntax-errors]: import from * only allowed at module scope (F406) #20166
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
Conversation
|
I have fixed the md file test which was causing CI to fail. Thank you |
|
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
|
have resolved the merge conflict as well. |
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
Signed-off-by: 11happy <soni5happy@gmail.com>
|
Hii @ntBre, would appreciate your feedback on this when you get a chance. |
ntBre
left a comment
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.
Thanks, this looks good overall, just a few smaller suggestions. While we're here, can we also update this comment:
| // F406 | |
| checker.report_diagnostic_if_enabled( | |
| pyflakes::rules::UndefinedLocalWithImportStarUsage { | |
| name: reference.name(checker.source()).to_string(), | |
| }, | |
| reference.range(), | |
| ); |
I was getting confused about this other case of F406 we're not handling, but I finally realized that the comment is just wrong. It should say F405, which is not a syntax error.
Signed-off-by: 11happy <soni5happy@gmail.com>
ntBre
left a comment
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.
Thank you! This looks great to me. I just had one more test idea for a future edge case.
Signed-off-by: 11happy <soni5happy@gmail.com>
ntBre
left a comment
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.
Thank you!
Summary
This PR implements F406 https://docs.astral.sh/ruff/rules/undefined-local-with-nested-import-star-usage/ as a semantic syntax error
Test Plan
I have written inline tests as directed in #17412