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 false positive for useless-super-delegation for variadics #6949

Merged
merged 7 commits into from Jun 15, 2022

Conversation

DanielNoord
Copy link
Collaborator

  • Write a good description on what the PR does.
  • Add an entry to the change log describing the change in
    doc/whatsnew/2/2.15/index.rst (or doc/whatsnew/2/2.14/full.rst
    if the change needs backporting in 2.14). If necessary you can write
    details or offer examples on how the new change is supposed to work.
  • If you used multiple emails or multiple names when contributing, add your mails
    and preferred name in script/.contributors_aliases.json

Type of Changes

Type
🐛 Bug fix

Description

Closes #2270.

@DanielNoord DanielNoord added Bug 🪲 False Positive 🦟 A message is emitted but nothing is wrong with the code labels Jun 14, 2022
@DanielNoord DanielNoord added this to the 2.14.2 milestone Jun 14, 2022
@coveralls
Copy link

coveralls commented Jun 14, 2022

Pull Request Test Coverage Report for Build 2501904284

  • 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.0005%) to 95.552%

Totals Coverage Status
Change from base Build 2500650324: 0.0005%
Covered Lines: 16413
Relevant Lines: 17177

💛 - Coveralls

@github-actions

This comment has been minimized.

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 !

@Pierre-Sassoulas Pierre-Sassoulas added the Needs backport Needs to be cherry-picked on the current patch version by a pylint's maintainer label Jun 14, 2022

class Sub(Super):
def __init__(self, a, b):
super().__init__(a, b)
Copy link
Member

Choose a reason for hiding this comment

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

How about when the first argument is required? I see the useless-super-delegation for this:

class Super:
    def __init__(self, *args):
        self.args = args

class Sub(Super):
    def __init__(self, a, *args):
        super().__init__(a, *args)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So you would want this to raise whenever there is only a variadic in super() and one or more positional in child?

Copy link
Member

Choose a reason for hiding this comment

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

@DanielNoord that's exactly it. It's just a variation of the original issue which someone may encounter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mbyrnepr2 Let me know what you think of this!

Copy link
Member

Choose a reason for hiding this comment

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

I think that will work @DanielNoord. I haven't time and haven't played with other variations but I think it's good to go. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Oh one thing is perhaps the comment on line 1279 is a bit inaccurate or hard to understand the underlying intention?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated!

Copy link
Member

Choose a reason for hiding this comment

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

Ah great lovely job!

@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 2.14.2, 2.14.3 Jun 15, 2022
@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 d70ea49

@DanielNoord DanielNoord merged commit 9069eb4 into pylint-dev:main Jun 15, 2022
@DanielNoord DanielNoord deleted the super branch June 15, 2022 11:37
@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 Jun 18, 2022
Pierre-Sassoulas pushed a commit to Pierre-Sassoulas/pylint that referenced this pull request Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported Bug 🪲 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 on useless-super-delegation with *args
4 participants