Skip to content

Commit

Permalink
Improve SimplifyTernary names and descriptions
Browse files Browse the repository at this point in the history
So that it's clearer what's happening and so there aren't multiple
recipes with the same name.
  • Loading branch information
mike-solomon committed Jan 17, 2024
1 parent f1e53d2 commit d24a0db
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 d24a0db

Please sign in to comment.