Remove if/else with identical branches
Recipe ID
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.AllBranchesIdenticalArtifactOpenRewrite.Recipes.CSharp.CodeQualityReplace an if/else chain where every branch has the same body with just the body, since the conditions have no effect on the outcome.
Single recipecsharpredundancycode-qualityProprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.AllBranchesIdenticalIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality