A function has more return statements than the limit
What it finds
A function has more return statements than the limit
def code(kind):tx0 reports: code has 7 return statements, more than the limit of 6 if kind == "a": return 1 if kind == "b": return 2 if kind == "c": return 3 if kind == "d": return 4 if kind == "e": return 5 if kind == "f": return 6 return 0 def few(kind): if kind: return 1 return 0 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:too-many-returns" = "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:too-many-returns] reason="..."tx0 explain tx0/python:too-many-returns shows the same in the terminal. Found a false positive? Report it.