-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[ruff
] Implicit class variable in dataclass (RUF045
)
#14349
base: main
Are you sure you want to change the base?
Conversation
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
RUF045 | 16 | 16 | 0 | 0 | 0 |
False positives found by ecosystem checks:
@dataclass
class FontFace:
family: str | None
emphasis: TextEmphasis | None
size_pt: int | None
color: DeviceGray | DeviceRGB | None
fill_color: DeviceGray | DeviceRGB | None
...
replace = dataclasses.replace
@dataclasses.dataclass(frozen=True)
class FuncFixtureInfo:
...
__slots__ = ("argnames", "initialnames", "names_closure", "name2fixturedefs") Special names can be exempted, but I'm not sure what to do about the first. |
I'm not saying we shouldn't do it, but requiring type annotations has been controversial in other instances; for example, there's a long thread for RUF012 that does something similar. @AlexWaygood I'd be interested on your take on this before I start reviewing the rule itself. |
Summary
Resolves #12877.
Test Plan
cargo nextest run
andcargo insta test
.