Redundancy code quality
Recipe ID
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RedundancyCodeQualityArtifactOpenRewrite.Recipes.CSharp.CodeQualityRemove redundant code from C# sources.
Composite 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.RedundancyCodeQualityIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQualityDefinition
This recipe runs the following recipes in order.
- Remove redundant ToString() call
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantToStringCall - Use rethrow instead of throw ex
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UseRethrow - Remove empty finally clause
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEmptyFinallyClause - Remove unnecessary else clause
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveUnnecessaryElse - Remove redundant ToCharArray() call
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantStringToCharArrayCall - Remove redundant parentheses
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantParentheses - Remove redundant cast
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantCast - Remove redundant default field initialization
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantDefaultFieldInitialization - Remove redundant base constructor call
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantBaseConstructorCall - Remove redundant sealed modifier
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantSealedModifier - Find empty catch clause
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEmptyCatchClause - Remove empty foreach body
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEmptyForEachBody - Remove empty while body
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEmptyWhileBody - Remove redundant async/await
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantAsyncAwait - Remove unused member declaration
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveUnusedMemberDeclaration - Remove redundant overriding member
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantOverridingMember - Remove redundant Dispose/Close call
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantDisposeOrClose - Remove redundant region
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantRegion - Flag empty for loop body
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEmptyForBody - Remove empty destructor
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEmptyDestructor - Remove redundant auto-property initialization
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantAutoPropertyInitialization - Remove redundant statement
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantStatement - Remove redundant delegate creation
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantDelegateCreation - Remove redundant assignment
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantAssignment - Remove unnecessary interpolated string
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryInterpolatedString - Remove redundant catch block
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantCatchBlock - Remove unnecessary case label
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveUnnecessaryCaseLabel - Remove redundant default switch section
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantDefaultSwitchSection - Remove redundant base interface
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantBaseInterface - Remove unnecessary unsafe context
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryUnsafeContext - Remove unnecessary null-forgiving operator
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryNullForgivingOperator - Find empty syntax
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEmptySyntax - Remove partial modifier from single-part type
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemovePartialModifierFromSinglePart - Remove enum default underlying type
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveEnumDefaultUnderlyingType - Remove argument list from attribute
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveArgumentListFromAttribute - Remove redundant as operator
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantAsOperator - Remove unnecessary verbatim string literal
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryVerbatimStringLiteral - Remove unnecessary null check
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryNullCheck - Remove unnecessary raw string literal
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryRawStringLiteral - Remove redundant constructor
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantAutoPropertyInit - Unused 'this' parameter
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveUnusedThisParameter - Unused element in documentation comment
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveUnusedDocCommentElement - Unnecessary enum flag
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryEnumFlag - Remove redundant 'sealed' modifier from override
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveRedundantSealedModifierFromOverride - Remove unnecessary semicolon at end of declaration
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveUnnecessarySemicolon - File contains no code
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.FileContainsNoCode - Unnecessary interpolation
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.UnnecessaryInterpolation - Resource can be disposed asynchronously
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.ResourceCanBeDisposedAsynchronously - Remove explicit 'class' from record
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RemoveExplicitClassFromRecord - Find internal types that may be unused
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.FindUnusedInternalType