← All recipes
Moderne licensed

Narrow bare except: to except Exception:

Recipe IDorg.openrewrite.python.cleanup.DoNotUseBareExceptArtifactopenrewrite-static-analysis

An unqualified except: intercepts every exception, including SystemExit and KeyboardInterrupt. Specifying Exception restricts the handler to ordinary runtime errors.

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

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

mod config recipes pip install openrewrite-static-analysis