Remove duplicate conditions in if/elif chains
Recipe ID
org.openrewrite.python.codequality.RemoveDuplicateConditionsArtifactopenrewrite-migrate-pythonRemove elif branches whose condition is identical to an earlier branch in the same if/elif chain, since the duplicate branch is dead code that can never execute.
Single recipepythoncode-qualityRSPEC-S1862Proprietary
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.RemoveDuplicateConditionsIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-python