Moderne OnlyThis recipe is proprietary to Moderne and runs on the Moderne platform or CLI — it isn’t part of the open-source catalog. Available with a Moderne subscription.
Redundancy code quality
Recipe ID
OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RedundancyCodeQualityArtifact
OpenRewrite.Recipes.CSharp.CodeQualityDefinition
Recipes50
50 recipes
- Remove redundant ToString() call
- Use rethrow instead of throw ex
- Remove empty finally clause
- Remove unnecessary else clause
- Remove redundant ToCharArray() call
- Remove redundant parentheses
- Remove redundant cast
- Remove redundant default field initialization
- Remove redundant base constructor call
- Remove redundant sealed modifier
- Find empty catch clause
- Remove empty foreach body
- Remove empty while body
- Remove redundant async/await
- Remove unused member declaration
- Remove redundant overriding member
- Remove redundant Dispose/Close call
- Remove redundant region
- Flag empty for loop body
- Remove empty destructor
- Remove redundant auto-property initialization
- Remove redundant statement
- Remove redundant delegate creation
- Remove redundant assignment
- Remove unnecessary interpolated string
- Remove redundant catch block
- Remove unnecessary case label
- Remove redundant default switch section
- Remove redundant base interface
- Remove unnecessary unsafe context
- Remove unnecessary null-forgiving operator
- Find empty syntax
- Remove partial modifier from single-part type
- Remove enum default underlying type
- Remove argument list from attribute
- Remove redundant as operator
- Remove unnecessary verbatim string literal
- Remove unnecessary null check
- Remove unnecessary raw string literal
- Remove redundant constructor
- Unused 'this' parameter
- Unused element in documentation comment
- Unnecessary enum flag
- Remove redundant 'sealed' modifier from override
- Remove unnecessary semicolon at end of declaration
- File contains no code
- Unnecessary interpolation
- Resource can be disposed asynchronously
- Remove explicit 'class' from record
- Find internal types that may be unused
Usage
Run this recipe
In order to run C# recipes, you will need to use the Moderne CLI.
Once the CLI is installed, you can install this C# recipe package by running the following command:
Install the recipe package
mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality
Then, you can run the recipe via:
Run the recipe
mod run . --recipe OpenRewrite.Recipes.CSharp.CodeQuality.Redundancy.RedundancyCodeQuality