Guard mutable default arguments with None sentinel
Recipe ID
org.openrewrite.python.cleanup.DefaultMutableArgArtifactopenrewrite-static-analysisChange mutable default values ([], {}, set()) to None and prepend an if arg is None: arg = <original> guard so each call gets its own fresh instance.
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.DefaultMutableArgIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-static-analysis