Skip to content

Emit used-before-assignment for further imports guarded by TYPE_CHECKING #7806

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 5 commits into from
Dec 10, 2022

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Previously, this message was only emitted for imports guarded directly under TYPE_CHECKING, not guarded two if-branches deep, nor when TYPE_CHECKING was imported from typing under an alias.

Closes #7539

…CKING

Previously, this message was only emitted for imports guarded directly under
TYPE_CHECKING, not guarded two if-branches deep, nor when TYPE_CHECKING
was imported from typing under an alias.
@jacobtylerwalls jacobtylerwalls added False Negative πŸ¦‹ No message is emitted but something is wrong with the code C: used-before-assignment Issues related to 'used-before-assignment' check labels Nov 20, 2022
@jacobtylerwalls jacobtylerwalls added this to the 2.16.0 milestone Nov 20, 2022
@coveralls
Copy link

coveralls commented Nov 20, 2022

Pull Request Test Coverage Report for Build 3548460782

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.0002%) to 95.427%

Totals Coverage Status
Change from base Build 3546254739: -0.0002%
Covered Lines: 17551
Relevant Lines: 18392

πŸ’› - Coveralls

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

in_type_checking_block is indeed a lot more accurate πŸ˜„

@github-actions

This comment has been minimized.

@jacobtylerwalls
Copy link
Member Author

jacobtylerwalls commented Nov 20, 2022

The false positive in flask is already documented at #7609. It's true that this PR will ever so slightly drive more traffic into that false positive, but I don't think that's a reason not to merge it, because whenever someone picks it up, we'll immediately backport it. EDIT: I opened #7810 to fix it

@github-actions
Copy link
Contributor

πŸ€– According to the primer, this change has no effect on the checked open source code. πŸ€–πŸŽ‰

This comment was generated for commit f9fea0f

@jacobtylerwalls
Copy link
Member Author

@Pierre-Sassoulas This one's ready for review, if you get a chance.

Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

LGTM πŸ‘Œ Thanks for the reminder !

@Pierre-Sassoulas Pierre-Sassoulas merged commit e7ef1fd into pylint-dev:main Dec 10, 2022
@jacobtylerwalls jacobtylerwalls deleted the issue-7539 branch December 10, 2022 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: used-before-assignment Issues related to 'used-before-assignment' check False Negative πŸ¦‹ No message is emitted but something is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audit remaining uses of TYPING_TYPE_CHECKS_GUARDS
3 participants