A function ends with return None although it returns no other value, so the statement repeats what falling off the end does

tx0/python:redundant-return-noneallnotestyle/conventionsdepth faststyle

What it finds

A function that never returns anything else gives None when it reaches its end; an explicit return None as the last statement adds nothing. Functions that return values on other paths keep it, as it makes the None case visible there.

From the rule's source, redundant_return_none.rs.

Example from the rule's tests
def log(x):    print(x)    return Nonetx0 reports: falling off the end returns None already def find(xs):    for x in xs:        if x:            return x    return None
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 all tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:redundant-return-none" = "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:redundant-return-none] reason="..."

tx0 explain tx0/python:redundant-return-none shows the same in the terminal. Found a false positive? Report it.