Simplify boolean return

MSAL

Simplifies if statements that only return true or false to a single return. For example, if (a) { return true; } return false; simplifies to return a;. Wrapping a boolean expression in an if-then-else just to return true or false adds unnecessary control flow that obscures the straightforward intent of the expression.

org.openrewrite.staticanalysis.SimplifyBooleanReturn
mod run . --recipe=org.openrewrite.staticanalysis.SimplifyBooleanReturn

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.