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

Forbid subclasses to have the exact same methods as superclasses #159

Closed
sobolevn opened this issue Jan 29, 2022 · 4 comments
Closed

Forbid subclasses to have the exact same methods as superclasses #159

sobolevn opened this issue Jan 29, 2022 · 4 comments

Comments

@sobolevn
Copy link
Member

Right now this code is not an error:

class A:
    def some(self) -> int: ...

class B(A):
    def some(self) -> int: ...

But, it is not a good style. I propose to add a check for this.
Related python/typeshed#7073

@AlexWaygood
Copy link
Collaborator

I agree that this would be great. It might be tricky to implement (but my mind is already racing with ideas about how to do it 😀).

We would also have to exclude dunder methods, because we would get a lot of false positives (see discussion in python/typeshed#6877).

@sobolevn
Copy link
Member Author

Offtopic, @AlexWaygood if you are intersted in flake8 plugins, I welcome you giving https://github.com/wemake-services/wemake-python-styleguide a try. It has lots of open feature requests (all are pretty non-trivial).

@AlexWaygood
Copy link
Collaborator

Offtopic, @AlexWaygood if you are intersted in flake8 plugins, I welcome you giving https://github.com/wemake-services/wemake-python-styleguide a try. It has lots of open feature requests (all are pretty non-trivial).

I'll add it to my to-do list 😄

@AlexWaygood
Copy link
Collaborator

As discussed in python/mypy#13321, this check would be a better fit for a linter that can harness the power of a type checker; let's do that instead.

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants