The methods of a class assign more attributes of self than the configured limit
What it finds
A class with many instance attributes holds a lot of state, and usually several concerns that could live in classes of their own. Counted are the distinct names x in assignments to self.x in the methods of the class, through the name of their first parameter.
From the rule's source, many_instance_attributes.rs.
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:many-instance-attributes" = "warning"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:many-instance-attributes] reason="..."tx0 explain tx0/python:many-instance-attributes shows the same in the terminal. Found a false positive? Report it.