← All recipes
Moderne licensed

Remove unconditional value overwrites

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

Remove consecutive assignments that write to the same dict key or object attribute, since the first value is immediately overwritten and never used. A write the second one can still observe -- by reading the target back, or through the object holding it -- is left alone.

Single recipepythonRSPEC-S4143code-qualityProprietary

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

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

mod config recipes pip install openrewrite-migrate-python