An if returns true in one branch and false in the other, which is returning its condition

tx0/csharp:if-return-boolallwarningstyle/conventionsdepth faststyle

What it finds

if (ready) return true; else return false;, and the same with the else left out and the second return following the if, says return ready; in four lines.

From the rule's source, if_return_bool.rs.

Example from the rule's tests
class Rules{    bool Allowed(int age)    {        if (age >= 18)tx0 reports: this if returns true or false by its condition        {            return true;        }        return false;    }     bool Same(int age)    {        if (age > 0)        {            return true;        }        return true;    }}
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/csharp:if-return-bool" = "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/csharp:if-return-bool] reason="..."

tx0 explain tx0/csharp:if-return-bool shows the same in the terminal. Found a false positive? Report it.