← All recipes
Moderne licensed

Flatten negated logic via De Morgan's identities

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

Use De Morgan's identities to remove double negation and to distribute `not into compound conditions, e.g. not not finished becomes finished and not (m and n) becomes not m or not n`.

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

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

mod config recipes pip install openrewrite-static-analysis