Skip to content

Commit

Permalink
Merge pull request #243 from openrewrite/fix-ternary
Browse files Browse the repository at this point in the history
Improve SimplifyTernary names and descriptions
  • Loading branch information
mike-solomon authored Jan 17, 2024
2 parents f1e53d2 + d24a0db commit 8c21316
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
import com.google.errorprone.refaster.annotation.BeforeTemplate;
import org.openrewrite.java.template.RecipeDescriptor;

@RecipeDescriptor(
name = "Simplify ternary expressions",
description = "Simplifies various types of ternary expressions to improve code readability."
)
public class SimplifyTernary {

@RecipeDescriptor(
name = "Simplify ternary expressions",
description = "Simplify `expr ? true : false` to `expr`."
name = "Replace `booleanExpression ? true : false` with `booleanExpression`",
description = "Replace ternary expressions like `booleanExpression ? true : false` with `booleanExpression`."
)
public static class SimplifyTernaryTrueFalse {

Expand All @@ -39,8 +43,8 @@ boolean after(boolean expr) {
}

@RecipeDescriptor(
name = "Simplify ternary expressions",
description = "Simplify `expr ? false : true` to `!expr`."
name = "Replace `booleanExpression ? false : true` with `!booleanExpression`",
description = "Replace ternary expressions like `booleanExpression ? false : true` with `!booleanExpression`."
)
public static class SimplifyTernaryFalseTrue {

Expand Down

0 comments on commit 8c21316

Please sign in to comment.