← All recipes
Moderne licensed

Merge collapsible if statements

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

Combine nested if statements that have no else branch into a single if joined with and.

Single recipepythonRSPEC-S1066code-qualityProprietary

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.CollapsibleIfStatements

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

mod config recipes pip install openrewrite-migrate-python