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

Feature request: ignore PLW3201 for methods marked with @override #6958

Closed
Avasam opened this issue Aug 28, 2023 · 2 comments · Fixed by #7224
Closed

Feature request: ignore PLW3201 for methods marked with @override #6958

Avasam opened this issue Aug 28, 2023 · 2 comments · Fixed by #7224
Assignees
Labels
accepted Ready for implementation good first issue Good for newcomers

Comments

@Avasam
Copy link

Avasam commented Aug 28, 2023

Same request and reasoning as #3910

Python 3.12 will introduce the override decorator. It is already backported by typing_extensions.

Overridden method names are out of the dev's control when subclassing an external library. An example of this are Enum's _generate_next_value_. Ruff could understand that there's nothing the dev can do about the names if a method is marked with @override (and it'll still raise anyway on the base class if it's internal).

@Avasam Avasam changed the title Feature request: ignore _generate_next_value_ for methods marked with @override Feature request: ignore PLW3201 for methods marked with @override Aug 28, 2023
@zanieb zanieb added good first issue Good for newcomers accepted Ready for implementation labels Aug 28, 2023
@brendonh8
Copy link
Contributor

I can take this if nobody has yet

@charliermarsh
Copy link
Member

Go for it @brendonh8

charliermarsh pushed a commit that referenced this issue Sep 12, 2023
## Summary

Closes #6958.

If a method has the `override` decorator, there is nothing you can do
about incorrect dunder methods, so they should be ignored.

## Test Plan

Overridden incorrect dunder method was added to the tests to verify ruff
doesn't catch it when evaluating the file. Snapshot changes are all just
line number changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants