Skip to content

Fix used-before-assignment false positive for class definition in function scope #5937

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

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Fix false used-before-assignment for a class definition nested under a function subclassing a class defined outside the function. Because the class is guarded by a function, the parent class should be available at runtime.

Closes #4590

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2009079950

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0007%) to 94.079%

Totals Coverage Status
Change from base Build 2008382929: 0.0007%
Covered Lines: 15189
Relevant Lines: 16145

πŸ’› - Coveralls

@jacobtylerwalls jacobtylerwalls changed the title Fix #4590: used-before-assignment false positive for class definition in function scope Fix used-before-assignment false positive for class definition in function scope Mar 20, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Mar 20, 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.

LGTM, thank you !

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.0 milestone Mar 20, 2022
@Pierre-Sassoulas Pierre-Sassoulas merged commit 2cb5536 into pylint-dev:main Mar 21, 2022
@jacobtylerwalls jacobtylerwalls deleted the class-nested-under-function branch March 21, 2022 11:48
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.

False positive for class definition in function scope
4 participants