We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
First of all, once again, I'd like to thank you for a great library.
The recently added RUF012 rule warns with false positives for classes that extend a Pydantic model.
from pydantic import BaseModel class A(BaseModel): lst = [] class B(A): lst2 = [] # RUF012
Ruff version: ruff 0.0.277
ruff 0.0.277
The text was updated successfully, but these errors were encountered:
mutable-class-default
RUF012
Hi @charliermarsh 👋 Any eta on this issue?
Sorry, something went wrong.
I think this can be closed? At least the given example cannot be reproduced unless there's something more to it.
the comment on the linked pull request suggests the fix only works for direct inheritance, and not transitive inheritance
Perhaps it would be worth having an option to specify the parent classes to ignore when applying this rule?
For example, I'm using Beanie and running into a similar issue whereby this rule should be ignored for beanie.Document subclasses.
Something like;
[tool.ruff.lint.ruff] ignore-ruf012-classes = ["pydantic.BaseModel", "beanie.Document"]
Should the tag multifile-analysis be added, as base classes could be in other files?
multifile-analysis
No branches or pull requests
First of all, once again, I'd like to thank you for a great library.
The recently added RUF012 rule warns with false positives for classes that extend a Pydantic model.
Ruff version:
ruff 0.0.277
The text was updated successfully, but these errors were encountered: