Two members of a class have names that are equal apart from upper and lower case
What it finds
getUrl and getURL in one class are easy to mix up: a caller who picks the wrong one gets the other behaviour without any error. Compared are the methods, nested classes and names assigned in the class body. Stubs are not checked, since their names are those of the code they describe.
From the rule's source, case_only_name_clash.rs.
class Client: timeout = 3 def get_url(self): pass def get_URL(self):tx0 reports: get_URL differs from the member get_url only in upper and lower case pass TIMEOUT = 5tx0 reports: TIMEOUT differs from the member timeout @property def name(self): pass @name.setter def name(self, value): pass 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:case-only-name-clash" = "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:case-only-name-clash] reason="..."tx0 explain tx0/python:case-only-name-clash shows the same in the terminal. Found a false positive? Report it.