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

New rule request: instance attribute defined outside __init__ #16324

Closed
Garrett-R opened this issue Feb 23, 2025 · 1 comment
Closed

New rule request: instance attribute defined outside __init__ #16324

Garrett-R opened this issue Feb 23, 2025 · 1 comment

Comments

@Garrett-R
Copy link
Contributor

Description

PyCharm catches this:

class Foo:
    def define_attr(self):
        self.x = 5

by complaining that:

Instance attribute x defined outside __init__

Would be a nice Ruff rule!

@dylwil3
Copy link
Collaborator

dylwil3 commented Feb 23, 2025

Thanks! I have copied this over to #3040

@dylwil3 dylwil3 closed this as completed Feb 23, 2025
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