Skip to content

Emit used-before-assignment for self-referencing assignments under if conditions #6958

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 7 commits into from
Jun 15, 2022

Conversation

jacobtylerwalls
Copy link
Member

Type of Changes

Type
βœ“ πŸ› Bug fix

Description

Self-referencing assignments under if statements were getting a free pass.

Closes #6643

@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 Jun 15, 2022
@jacobtylerwalls jacobtylerwalls added this to the 2.15.0 milestone Jun 15, 2022
@coveralls
Copy link

coveralls commented Jun 15, 2022

Pull Request Test Coverage Report for Build 2503097274

  • 27 of 29 (93.1%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.007%) to 95.545%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pylint/checkers/utils.py 26 28 92.86%
Files with Coverage Reduction New Missed Lines %
pylint/checkers/utils.py 1 95.52%
Totals Coverage Status
Change from base Build 2501912757: -0.007%
Covered Lines: 16429
Relevant Lines: 17195

πŸ’› - Coveralls

@github-actions

This comment has been minimized.

@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 5b44577

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, nice refactor with returning the node instead of a boolean it feel a lot clearer that way.

@jacobtylerwalls jacobtylerwalls merged commit 54a3d7f into pylint-dev:main Jun 15, 2022
@jacobtylerwalls jacobtylerwalls deleted the self-ref-if branch June 15, 2022 23:30
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.

False negative used-before-assignment for self-referencing assignment in if-statement
3 participants