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

Guarantee that abstract method prototype equals override prototype #3355

Closed
roelvandergoot opened this issue Jan 19, 2020 · 3 comments · Fixed by #3392
Closed

Guarantee that abstract method prototype equals override prototype #3355

roelvandergoot opened this issue Jan 19, 2020 · 3 comments · Fixed by #3392
Labels
Checkers Related to a checker Good first issue Friendly and approachable by new contributors

Comments

@roelvandergoot
Copy link

Is your feature request related to a problem? Please describe

No.

Describe the solution you'd like

Create file "featreq.py"

"""Module doc string."""

from abc import abstractmethod


class Base:
    """Base doc string."""
    # pylint: disable=too-few-public-methods

    @abstractmethod
    async def func(self, arg):
        """func doc string."""


class Derived(Base):
    """Derived doc string."""
    # pylint: disable=too-few-public-methods

    def func(self, arg):
        return arg

Currently, pylint featreq.py produces:

------------------------------------
Your code has been rated at 10.00/10

What I would like:

featreq.py:19:4: W0000: Method differs from overridden 'func' method

Additional context

Note the additional "async" in method Base.func, or the missing "async" in method Derived.func.
Of course, the reverse, a missing "async" in method Base.func and an additional "async" in method Derived.func should also produce a warning.

@PCManticore PCManticore added Checkers Related to a checker Good first issue Friendly and approachable by new contributors labels Jan 26, 2020
@PCManticore
Copy link
Contributor

Thanks for the report! This would be an useful check.

@craig-sh
Copy link
Contributor

craig-sh commented Feb 8, 2020

Hi, I'd like to work on this issue.

Would it make more sense to have W0236: invalid-overridden-method include this case or to just create a new warning message? Currently invalid-overridden-method is specific to property checks.

EDIT: Submitted a PR that uses a new warning: invalid-overridden-coroutine

@roelvandergoot
Copy link
Author

roelvandergoot commented Feb 12, 2020 via email

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

Successfully merging a pull request may close this issue.

3 participants