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

disallow unnecessary methods #65

Closed
chdsbd opened this issue May 5, 2021 · 2 comments
Closed

disallow unnecessary methods #65

chdsbd opened this issue May 5, 2021 · 2 comments

Comments

@chdsbd
Copy link
Collaborator

chdsbd commented May 5, 2021

class MyClass:
    name: str
    def update(self, name: str) -> None:
        self.name = name
    def some_func(self, count: int) -> str:
        return f"foo:{count}"

Should be

def some_func(count: int) -> str:
    return f"foo:{count}"

class MyClass:
    name: str
    def update(self, name: str) -> None:
        self.name = name
@sbdchd
Copy link
Owner

sbdchd commented May 6, 2021

Curious about false positives. If we had a function that takes a Protocol as a param and this class was trying to satisfy that Protocol with the some_func method, appeasing the lint would result in a breakage.

@chdsbd
Copy link
Collaborator Author

chdsbd commented May 6, 2021

I was thinking about the protocol issue too. hmm.

@chdsbd chdsbd closed this as completed May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants