Replace Yoda conditions with normal comparisons
Recipe ID
org.openrewrite.python.cleanup.ReplaceYodaConditionsArtifactopenrewrite-migrate-pythonReplace Yoda conditions (e.g. None == x) with the conventional comparison order (e.g. x == None). A chained comparison, or one with a constant on both sides, is left alone. See Ruff rule SIM300.
Single recipepythoncleanupruffSIM300Proprietary
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.ReplaceYodaConditionsIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-python
mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-python:RELEASE
mod config recipes jar install org.openrewrite:rewrite-python:RELEASE