Skip to content

Make self-cls-assignment check tuple assignment #5268

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 3 commits into from
Nov 7, 2021

Conversation

DanielNoord
Copy link
Collaborator

  • Add yourself to CONTRIBUTORS if you are a new contributor.
  • Add a ChangeLog entry describing what your PR does.
  • If it's a new feature, or an important bug fix, add a What's New entry in
    doc/whatsnew/<current release.rst>.
  • Write a good description on what the PR does.

Type of Changes

Type
✨ New feature

Description

Continuation of #5254

Basically we only checked single assignments and will now also check tuple assignments.
Furthermore, I have removed some redundant code.

@DanielNoord DanielNoord added the False Negative 🦋 No message is emitted but something is wrong with the code label Nov 6, 2021
@DanielNoord DanielNoord added this to the 2.12.0 milestone Nov 6, 2021
@coveralls
Copy link

coveralls commented Nov 6, 2021

Pull Request Test Coverage Report for Build 1431817024

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

Totals Coverage Status
Change from base Build 1427293421: 0.002%
Covered Lines: 13771
Relevant Lines: 14753

💛 - 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.

Nice cleanup on top of the fix ! 👏

@cdce8p cdce8p self-requested a review November 7, 2021 04:54
child
for child in scope.body
if isinstance(child, nodes.Nonlocal) and assign_names & set(child.names)
child for child in scope.body if isinstance(child, nodes.Nonlocal)
Copy link
Member

Choose a reason for hiding this comment

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

It seems like we also need to do some more work on node.scope().

Cannot access member "body" for type "LocalsDictNodeNG"
  Member "body" is unknown

Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

Looks good! Can be merged once the imports are fixed.

@DanielNoord DanielNoord merged commit 6827dfe into pylint-dev:main Nov 7, 2021
@DanielNoord DanielNoord deleted the self-cls-2 branch November 7, 2021 16:12
Pierre-Sassoulas pushed a commit that referenced this pull request Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants