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

RUF012 shouldn't complain when type hint is not present #5244

Closed
harshil21 opened this issue Jun 21, 2023 · 4 comments
Closed

RUF012 shouldn't complain when type hint is not present #5244

harshil21 opened this issue Jun 21, 2023 · 4 comments

Comments

@harshil21
Copy link

harshil21 commented Jun 21, 2023

The following snippet produces an error which I think it shouldn't since there is no type annotation for that variable:

# test.py
class A:
    var = ["hey", "there"]

This gets particularly annoying in test suites, since adding type hints there (specially in this case) is not required imo.

Command

ruff test.py --select RUF --isolated

tests/ruff.py:2:11: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
Found 1 error.

Version

ruff 0.0.274

@scastlara
Copy link

related #5243

@harshil21
Copy link
Author

yeah just opened within a minute of each other :D

@charliermarsh
Copy link
Member

(Closing as a duplicate of #5244.)

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2023
@Thomasdezeeuw
Copy link
Contributor

(Closing as a duplicate of #5244.)

I think you meant #5243, since this is #5244.

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

4 participants