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

Fix bug in detecting unused-variable when iterating on variable. #7537

Merged
merged 2 commits into from
Sep 28, 2022

Conversation

clavedeluna
Copy link
Collaborator

Closes #3044

Type of Changes

Type
🐛 Bug fix

Description

unused-variable should not be reported in the case when a previously defined variable is now being used to iterate with.

Closes #3044

@clavedeluna clavedeluna marked this pull request as ready for review September 27, 2022 20:35
@coveralls
Copy link

coveralls commented Sep 27, 2022

Pull Request Test Coverage Report for Build 3138788546

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.315%

Totals Coverage Status
Change from base Build 3133265448: 0.0%
Covered Lines: 17109
Relevant Lines: 17950

💛 - Coveralls

@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 fd26bf6

@Pierre-Sassoulas Pierre-Sassoulas added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Sep 28, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.15.4 milestone Sep 28, 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.

Very elegant fix, it looks almost too simple. 😄 Let's wait for a review by @jacobtylerwalls before merging.

Copy link
Member

@jacobtylerwalls jacobtylerwalls left a comment

Choose a reason for hiding this comment

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

Thanks, that looks like the right fix. I wonder if we could eventually remove the isinstance entirely, but that would require more tests (in future). 👍🏻

@jacobtylerwalls jacobtylerwalls added the Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer label Sep 28, 2022
@Pierre-Sassoulas Pierre-Sassoulas merged commit 51a5850 into pylint-dev:main Sep 28, 2022
orSolocate pushed a commit to orSolocate/pylint that referenced this pull request Oct 1, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Backported and removed Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer labels Oct 9, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Oct 9, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported 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.

Problem with nonlocal written only falsely reported as unused.
4 participants