← All recipes
Moderne licensed

Drop `pass-only if` body by inverting the guard

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

When an `if body contains only pass and is followed by an else`, flip the condition and use the else body directly.

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

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

mod config recipes pip install openrewrite-static-analysis