Simplify redundant logical expressions

Proprietary

Replace x and x with x and x or x with x. Identical operands in a logical expression are redundant and often indicate a copy-paste mistake. Operands that may have side effects, such as a call, are left alone, since dropping one changes how often it runs. An expression holding comments is left alone too.

org.openrewrite.python.codequality.SimplifyRedundantLogicalExpression
mod run . --recipe=org.openrewrite.python.codequality.SimplifyRedundantLogicalExpression

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