← All recipes
Moderne licensed

Simplify redundant logical expressions

Recipe IDorg.openrewrite.python.codequality.SimplifyRedundantLogicalExpressionArtifactopenrewrite-migrate-python

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.

Single recipepythoncode-qualityRSPEC-S1764Proprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

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

If the recipe isn’t available locally, install it with:

mod config recipes pip install openrewrite-migrate-python