← All recipes
Moderne licensed

Simplify negated `elif to else

Recipe IDorg.openrewrite.python.cleanup.RemoveRedundantIfArtifactopenrewrite-static-analysis

When an `elif condition is the exact negation of the preceding if, replace it with else` since the test is redundant.

Single recipeProprietary

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.cleanup.RemoveRedundantIf

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

mod config recipes pip install openrewrite-static-analysis