Skip to content
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

Don't emit broken typing errors inside TYPE_CHECKING blocks #5984

Merged

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Mar 26, 2022

Description

broken-noreturn and broken-collections-callable errors should not be emitted inside if TYPE_CHECKING blocks. At runtime TYPE_CHECKING is false and thus the block is never executed and cannot fail.

@cdce8p cdce8p added this to the 2.13.1 milestone Mar 26, 2022
@cdce8p cdce8p added Enhancement ✨ Improvement to a component Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Mar 26, 2022
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.

👍 I like the little refactor too !

@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Enhancement ✨ Improvement to a component labels Mar 26, 2022
@Pierre-Sassoulas Pierre-Sassoulas merged commit 5d21f42 into pylint-dev:main Mar 26, 2022
@cdce8p cdce8p deleted the broken-checks-type_checking branch March 26, 2022 11:49
@Pierre-Sassoulas Pierre-Sassoulas removed the Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer label Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants