← All recipes
Moderne licensed

Collapse boolean ternary to bare condition

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

Replace `True if expr else False with expr and False if expr else True with not expr`, removing the redundant ternary wrapper.

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

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

mod config recipes pip install openrewrite-static-analysis