A method or attribute of a class has the class's own name

tx0/python:member-named-after-classstrictwarningsmell

What it finds

In class Item: a member named item makes item.item read like a mistake and hides what the member holds. Compared without regard to case are the methods and the names assigned in the class body; __init__ and other special methods are not affected, and neither are stubs, whose names are those of the code they describe.

From the rule's source, member_named_after_class.rs.

Example from the rule's tests
class Item:    item = Nonetx0 reports: the member item repeats the name of its class     def __init__(self):        pass  class Order:    def order(self):tx0 reports: the member order repeats the name of its class        pass     def orders(self):        pass
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

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:

tx0.toml
[rules]
"tx0/python:member-named-after-class" = "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:member-named-after-class] reason="..."

tx0 explain tx0/python:member-named-after-class shows the same in the terminal. Found a false positive? Report it.