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

useless-super-delegation when typing differs #1923

Closed
z33ky opened this issue Mar 9, 2018 · 2 comments
Closed

useless-super-delegation when typing differs #1923

z33ky opened this issue Mar 9, 2018 · 2 comments
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors

Comments

@z33ky
Copy link

z33ky commented Mar 9, 2018

Steps to reproduce

class Egg():
    def __init__(self, thing: object) -> None: ...

class Spam(Egg):
    def __init__(self, thing: int) -> None:
        super().__init__(thing)

This is useful so type-checkers can check that Spam is only ever created with int, while Eggs can be created with anything.

Current behavior

A warning is emitted: Useless super delegation in method '__init__' (useless-super-delegation).

Expected behavior

No warning.

pylint --version output

No config file found, using default configuration
pylint 1.8.2,
astroid 1.6.1
Python 3.6.4 (default, Jan  5 2018, 02:35:40)
[GCC 7.2.1 20171224]
@brycepg
Copy link
Contributor

brycepg commented Mar 10, 2018

I think it would be reasonable to only raise this warning when the annotations are the same (if any)

@PCManticore PCManticore added the Enhancement ✨ Improvement to a component label Mar 10, 2018
@AWhetter AWhetter added the Good first issue Friendly and approachable by new contributors label May 10, 2018
@AWhetter
Copy link
Contributor

To any new contributors looking to tackle this issue; the classes checker raises the useless-super-delegation message. _definition_equivalent_to_call will need to start considering the annotations of the arguments node of the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors
Projects
None yet
Development

No branches or pull requests

4 participants