Compare string to "" instead of checking len()
Recipe ID
org.openrewrite.python.cleanup.SimplifyStrLenComparisonArtifactopenrewrite-static-analysisReplace `len(text) == 0 with text == "" and len(text) > 0 / len(text) != 0 with text != ""`, comparing the string directly rather than measuring its length.
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.SimplifyStrLenComparisonIf the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-static-analysis