A function has more independent paths than the limit
What it finds
A function has more independent paths than the limit
def classify(a, b, c, d, items):tx0 reports: classify has a cyclomatic complexity of 21, above the limit of 20 if a: return 1 elif b: return 2 elif c or d: return 3 for item in items: if item and a: continue while b: b -= 1 try: pass except ValueError: pass except KeyError: pass values = [x for x in items if x] if a and b and c and d or items: return values return values if a else (c and d or b) def simple(a): if a: return 1 return 0 Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:cyclomatic-complexity" = "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:cyclomatic-complexity] reason="..."tx0 explain tx0/python:cyclomatic-complexity shows the same in the terminal. Found a false positive? Report it.