A name assigned in a class body follows neither the configured style nor UPPER_CASE
What it finds
Names assigned in a class body are fields or constants of the class. Fields follow the style of the style parameter, snake_case by default, and constants are written in UPPER_CASE; a name in either style passes. Enum members, which are often written as the values they stand for, are not checked: classes whose bases end in Enum, Flag or Choices.
The style is set by the style parameter: snake_case, PascalCase, camelCase, UPPER_CASE, or any to accept every name. Leading and trailing underscores are not part of the style, and names with letters outside ASCII are not judged. Names that match one of the ignore patterns, where * stands for any text, are left alone. Stubs are not checked, since their names are those of the code they describe.
From the rule's source, class_attribute_name_style.rs.
class Config: maxSize = 10tx0 reports: the class attribute maxSize is written in neither snake_case nor UPPER_CASE MAX_SIZE = 10 default_name: str = "x" __slots__ = () class Color(Enum): Red = 1 lightBlue = 2 Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:class-attribute-name-style" = "note"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:class-attribute-name-style] reason="..."tx0 explain tx0/python:class-attribute-name-style shows the same in the terminal. Found a false positive? Report it.