Skip to content

Introduce Y022/Y023/Y024/Y025: Imports linting error codes #97

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 20 commits into from
Jan 18, 2022

Conversation

AlexWaygood
Copy link
Collaborator

Helps work towards #80 and #32. I've tried to keep these error codes completely cross-compatible between Python 2 and Python 3 -- I think it would be best to leave Python-3-only changes (e.g. disallowing typing.ContextManager and typing_extensions.OrderedDict) can be left for another error code.

@AlexWaygood AlexWaygood changed the title Introduce Y022 & Y023: Imports linting error codes Introduce Y022/Y023/Y024/Y025: Imports linting error codes Jan 17, 2022
@AlexWaygood AlexWaygood marked this pull request as draft January 17, 2022 19:36
@AlexWaygood AlexWaygood marked this pull request as ready for review January 17, 2022 23:43
@AlexWaygood
Copy link
Collaborator Author

Okay, should be ready for review now. I'll hold off running a codemodding script on the Python-2 parts of typeshed until people have had a chance to review :)

Co-authored-by: Jelle Zijlstra <[email protected]>
@AlexWaygood
Copy link
Collaborator Author

I will get codemodding tomorrow!

@AlexWaygood
Copy link
Collaborator Author

AlexWaygood commented Jan 18, 2022

Typeshed PR to make the CI go green:

TODO:

@AlexWaygood AlexWaygood reopened this Jan 18, 2022
@AlexWaygood
Copy link
Collaborator Author

AlexWaygood commented Jan 18, 2022

Ohhhh I hardcoded Y019 to look for type[_T] (but not Type[_T]), so changing all occurences of Type to type in Python-2 typeshed stubs has caused the CI to pick up on a bunch of new Y019 errors.

@AlexWaygood
Copy link
Collaborator Author

AlexWaygood commented Jan 18, 2022

flake8 is complaining that PyiVisitor._check_import_or_attribute is too complex for one function. However, I think it would make the code more complex to split it up into several smaller functions, so I am going to # noqa it. Let me know if you disagree.

@AlexWaygood
Copy link
Collaborator Author

flake8 is complaining that PyiVisitor._check_import_or_attribute is too complex for one function. However, I think it would make the code more complex to split it up into several smaller functions, so I am going to # noqa it. Let me know if you disagree.

Actually, I'll leave it for now, since I might be refactoring that function anyway.

@AlexWaygood
Copy link
Collaborator Author

A second typeshed PR to try to get the CI green is here: python/typeshed#6954

@AlexWaygood AlexWaygood reopened this Jan 18, 2022
@AlexWaygood
Copy link
Collaborator Author

...And a third typeshed PR: python/typeshed#6955

@AlexWaygood AlexWaygood reopened this Jan 18, 2022
@AlexWaygood
Copy link
Collaborator Author

CI is finally green, and I think I've addressed the points @Akuli raised (just two dicts now, and managed to get rid of the icky quotes-within-quotes everywhere). Re-requesting review from you, @JelleZijlstra, if that's okay, as it's changed a fair bit since when you approved it :)

Copy link
Collaborator

@Akuli Akuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skimmed. No red flags.

@Akuli Akuli merged commit de1f20c into PyCQA:master Jan 18, 2022
@AlexWaygood AlexWaygood deleted the imports branch January 18, 2022 22:59
@AlexWaygood
Copy link
Collaborator Author

Skimmed. No red flags.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants