← All recipes
Moderne licensed

Remove trailing return None from functions

Recipe IDorg.openrewrite.python.cleanup.RemoveTrailingReturnNoneArtifactopenrewrite-migrate-python

Delete return None or a bare return when it is the last statement in a function body and no other return yields a non-None value. A return holding a comment is kept, as is one that is the function's only statement.

Single recipePLR1711pythoncleanupruffProprietary

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

If 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