← All recipes
Moderne licensed

Delete if blocks whose body is only pass

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

Delete if statements that contain nothing but pass and have no else branch. for/while loops are left alone because iterating may have side effects.

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

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

mod config recipes pip install openrewrite-static-analysis