The condition of if, elif or while, or the value of return, is wrapped in parentheses that do nothing

tx0/python:parenthesized-conditionstrictnotestyle

What it finds

if (ready): and return (value) carry parentheses that Python does not need, a habit from languages whose syntax does. Parentheses that span several lines, hold a tuple, a yield or :=, or follow the keyword without a space are left alone. The fix removes them and is safe.

From the rule's source, parenthesized_condition.rs.

Example from the rule's tests
def check(a, b):    if (a > b):tx0 reports: the parentheses around this condition do nothing        return (a)tx0 reports: the parentheses around the value of return do nothing    while (a):tx0 reports: the parentheses around this condition do nothing        a -= 1    if (a and            b):        pass    if(a):        pass    return (a, b)
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:parenthesized-condition" = "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:parenthesized-condition] reason="..."

tx0 explain tx0/python:parenthesized-condition shows the same in the terminal. Found a false positive? Report it.