Simplification code quality

Proprietary

Simplify expressions and patterns in C# code.

OpenRewrite.Recipes.CSharp.CodeQuality.Simplification.SimplificationCodeQuality
mod run . --recipe=OpenRewrite.Recipes.CSharp.CodeQuality.Simplification.SimplificationCodeQuality

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

  1. Remove redundant boolean literal
  2. Simplify boolean comparison
  3. Use compound assignment
  4. Simplify logical negation
  5. Simplify conditional expression
  6. Use coalesce expression
  7. Merge else with nested if
  8. Merge if with parent if
  9. Use postfix increment/decrement
  10. Simplify numeric comparison
  11. Use string.StartsWith instead of IndexOf comparison
  12. Simplify Nullable<T>.HasValue
  13. Use string interpolation instead of string.Format
  14. Use conditional access
  15. Convert 'if' to assignment
  16. Use conditional throw expression
  17. Merge consecutive Where calls
  18. Remove unnecessary braces
  19. Simplify nested using statement
  20. Use throw expression
  21. Use switch expression
  22. Use default literal
  23. Simplify do-while(true) to while(true)
  24. Use pattern matching instead of as
  25. Use pattern matching instead of is
  26. Simplify lazy initialization
  27. Use exception filter
  28. Convert anonymous method to lambda
  29. Use range operator
  30. Simplify negated is null pattern
  31. Use 'not' pattern instead of negation
  32. Use string.EndsWith
  33. Use short-circuit operator
  34. Use ^ operator for boolean inequality
  35. Merge switch sections with equivalent content
  36. Inline local variable
  37. Use for statement instead of while
  38. Simplify coalesce expression
  39. Expression is always true or false
  40. Convert interpolated string to concatenation
  41. Use string interpolation instead of concatenation
  42. Simplify code branching
  43. Join string expressions
  44. Use conditional access instead of conditional expression
  45. Simplify Nullable<T> to T?
  46. Combine 'Enumerable.Where' method chain
  47. Unconstrained type parameter checked for null
  48. Use 'is' operator instead of 'as' operator
  49. Use anonymous function or method group
  50. Operator is unnecessary
  51. Inline lazy initialization
  52. Use Guid.Empty
  53. Use DateTime.UnixEpoch
  54. Use DateTimeOffset.UnixEpoch
  55. Use TimeSpan.Zero
  56. Use string.Equals instead of == for string comparison
  57. Use pattern matching for equality comparison
  58. Use pattern matching for inequality comparison
  59. Use pattern matching instead of HasValue
  60. Use 'is' pattern instead of SequenceEqual