A bare return ends a function, or continue ends a loop body, where control goes anyway

tx0/python:jump-at-block-endstrictwarningstyle

What it finds

A bare return as the last statement of a function, or continue as the last statement of a loop body: control goes there anyway, so the statement does nothing. When it is the only statement of the body, it stands in for pass and is left alone.

From the rule's source, jump_at_block_end.rs.

Example from the rule's tests
def save(x):    x.write()    returntx0 reports: this jump does nothing: the function ends here anyway  def stub():    return  def loop(items):    for item in items:        item.go()        continuetx0 reports: this jump does nothing: the next pass starts here anyway    while items:        continue
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:jump-at-block-end" = "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:jump-at-block-end] reason="..."

tx0 explain tx0/python:jump-at-block-end shows the same in the terminal. Found a false positive? Report it.