Several isinstance calls on the same value are joined with or, where one call with a tuple of types says the same
What it finds
isinstance(x, int) or isinstance(x, float) repeats the value and the call; isinstance(x, (int, float)) tests all the types at once.
From the rule's source, isinstance_calls_mergeable.rs.
def number(x, y): a = isinstance(x, int) or isinstance(x, float)tx0 reports: one isinstance with a tuple of types tests the same b = isinstance(x, int) or isinstance(y, int) return a, b Turn it on, off or suppress it
The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:isinstance-calls-mergeable" = "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:isinstance-calls-mergeable] reason="..."tx0 explain tx0/python:isinstance-calls-mergeable shows the same in the terminal. Found a false positive? Report it.