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

Add "implement all inherited abstract classes" code action as a quick fix for reportAbstractUsage #5757

Closed
luabud opened this issue Apr 12, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@luabud
Copy link
Member

luabud commented Apr 12, 2024

I was trying out the "implement all inherited abstract classes" code action which I love, and then it occurred to be that it could be nice if there was also a quick fix available when reportAbstractUsage is reported due to the class being instantiated without having the abstract methods implemented (when typecheckingmode is set to basic or strict). For example:

from abc import ABC, abstractmethod

class Shape(ABC):
    @abstractmethod
    def area(self):
        pass

    @abstractmethod
    def perimeter(self):
        pass


class Rectangle(Shape):
    def __init__(self, length, width):
        self.length = length
        self.width = width

    def area(self):
        return self.length*self.width

    ### missing perimeter here

rectangle = Rectangle(5, 3) ### --> reportAbstractUsage reported due to missing perimeter implementation under Rectangle

I guess there may be problem of differentiating this error vs when it happens due to someone calling e.g. shape = Shape(), since it also reports the same error?

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Apr 12, 2024
@luabud luabud added enhancement New feature or request and removed needs repro Issue has not been reproduced yet labels Apr 12, 2024
@luabud
Copy link
Member Author

luabud commented Apr 12, 2024

cc @StellaHuang95

@heejaechang heejaechang added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Apr 25, 2024
@KacieKK
Copy link
Contributor

KacieKK commented May 9, 2024

This issue has been fixed in prerelease version 2024.5.100, which we've just released. You can find the changelog here: CHANGELOG.md

@KacieKK KacieKK closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants