Simplify redundant logical expressions
ProprietaryReplace 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. SimplifyRedundantLogicalExpressionmod run . --recipe= org. openrewrite. python. codequality. SimplifyRedundantLogicalExpressionInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.