Simplification code quality
ProprietarySimplify expressions and patterns in C# code.
OpenRewrite. Recipes. CSharp. CodeQuality. Simplification. SimplificationCodeQualitymod run . --recipe= OpenRewrite. Recipes. CSharp. CodeQuality. Simplification. SimplificationCodeQualityInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Remove redundant boolean literal
- Simplify boolean comparison
- Use compound assignment
- Simplify logical negation
- Simplify conditional expression
- Use coalesce expression
- Merge else with nested if
- Merge if with parent if
- Use postfix increment/decrement
- Simplify numeric comparison
- Use string.StartsWith instead of IndexOf comparison
- Simplify Nullable<T>.HasValue
- Use string interpolation instead of string.Format
- Use conditional access
- Convert 'if' to assignment
- Use conditional throw expression
- Merge consecutive Where calls
- Remove unnecessary braces
- Simplify nested using statement
- Use throw expression
- Use switch expression
- Use default literal
- Simplify do-while(true) to while(true)
- Use pattern matching instead of as
- Use pattern matching instead of is
- Simplify lazy initialization
- Use exception filter
- Convert anonymous method to lambda
- Use range operator
- Simplify negated is null pattern
- Use 'not' pattern instead of negation
- Use string.EndsWith
- Use short-circuit operator
- Use ^ operator for boolean inequality
- Merge switch sections with equivalent content
- Inline local variable
- Use for statement instead of while
- Simplify coalesce expression
- Expression is always true or false
- Convert interpolated string to concatenation
- Use string interpolation instead of concatenation
- Simplify code branching
- Join string expressions
- Use conditional access instead of conditional expression
- Simplify Nullable<T> to T?
- Combine 'Enumerable.Where' method chain
- Unconstrained type parameter checked for null
- Use 'is' operator instead of 'as' operator
- Use anonymous function or method group
- Operator is unnecessary
- Inline lazy initialization
- Use Guid.Empty
- Use DateTime.UnixEpoch
- Use DateTimeOffset.UnixEpoch
- Use TimeSpan.Zero
- Use string.Equals instead of == for string comparison
- Use pattern matching for equality comparison
- Use pattern matching for inequality comparison
- Use pattern matching instead of HasValue
- Use 'is' pattern instead of SequenceEqual