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

RET501 should exempt properties #12197

Closed
epenet opened this issue Jul 5, 2024 · 1 comment · Fixed by #12243
Closed

RET501 should exempt properties #12197

epenet opened this issue Jul 5, 2024 · 1 comment · Fixed by #12243
Labels
accepted Ready for implementation help wanted Contributions especially welcome rule Implementing or modifying a lint rule

Comments

@epenet
Copy link
Contributor

epenet commented Jul 5, 2024

A property is normally meant to be consumed.

class Class:
    @property
    def data(self) -> None:
        return None
        # RET501 [*] Do not explicitly `return None` in function if it is the only possible return value

Based on home-assistant/core#115031

Note: the main case is when overriding base properties, so this may not be needed if #12198 is resolved.

@AlexWaygood
Copy link
Member

Yeah, I agree you'd probably want to explicitly return None in a property. PR welcome!

@AlexWaygood AlexWaygood added rule Implementing or modifying a lint rule help wanted Contributions especially welcome accepted Ready for implementation labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation help wanted Contributions especially welcome rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants