← All recipes
Moderne licensed

Boolean checks should not be inverted

Recipe IDorg.openrewrite.python.codequality.BooleanChecksNotInvertedArtifactopenrewrite-migrate-python

Replace inverted boolean comparisons like not (a == b) with the equivalent direct operator (a != b), and remove double negations like not (not x).

Single recipepythoncode-qualityRSPEC-S1940Proprietary

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.codequality.BooleanChecksNotInverted

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

mod config recipes pip install openrewrite-migrate-python