StringRules Refaster recipes
Recipe ID
tech.picnic.errorprone.refasterrules.StringRulesRecipesArtifactorg.openrewrite.recipe:rewrite-third-partyRefaster rules related to expressions dealing with Strings.
Source.
Composite recipeApache 2.0
Add to your build
Get a download tokenSign in with GitHub or Google, and your token replaces YOUR_DOWNLOAD_TOKEN below. Free for open source recipes like this one.
~/.gradle/gradle.properties
codeGenomeUsername=you@example.com
codeGenomeToken=YOUR_DOWNLOAD_TOKEN
build.gradle.kts
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}
rewrite {
activeRecipe("tech.picnic.errorprone.refasterrules.StringRulesRecipes")
}
repositories {
mavenCentral()
maven {
url = uri("https://artifacts.codegenomeproject.org/maven")
credentials {
username = providers.gradleProperty("codeGenomeUsername").get()
password = providers.gradleProperty("codeGenomeToken").get()
}
}
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-third-party:0.48.0")
}
Then run
./gradlew rewriteRunUsage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe tech.picnic.errorprone.refasterrules.StringRulesRecipesIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-third-party:RELEASEDefinition
This recipe runs the following recipes in order.
- Refaster template
StringRules.EmptyStringtech.picnic.errorprone.refasterrules.StringRulesRecipes$EmptyStringRecipe - Refaster template
StringRules.StringIdentitytech.picnic.errorprone.refasterrules.StringRulesRecipes$StringIdentityRecipe - Refaster template
StringRules.StringIsEmptyWithStringtech.picnic.errorprone.refasterrules.StringRulesRecipes$StringIsEmptyWithStringRecipe - Refaster template
StringRules.StringIsEmptytech.picnic.errorprone.refasterrules.StringRulesRecipes$StringIsEmptyRecipe - Refaster template
StringRules.NotStringIsEmptytech.picnic.errorprone.refasterrules.StringRulesRecipes$NotStringIsEmptyRecipe - Refaster template
StringRules.StringsIsNullOrEmptytech.picnic.errorprone.refasterrules.StringRulesRecipes$StringsIsNullOrEmptyRecipe - Prefer
String#isBlank()over less efficient alternativestech.picnic.errorprone.refasterrules.StringRulesRecipes$StringIsBlankRecipe - Refaster template
StringRules.OptionalOfNullableFilterNotStringIsEmptytech.picnic.errorprone.refasterrules.StringRulesRecipes$OptionalOfNullableFilterNotStringIsEmptyRecipe - Refaster template
StringRules.OptionalFilterNotStringIsEmptytech.picnic.errorprone.refasterrules.StringRulesRecipes$OptionalFilterNotStringIsEmptyRecipe - Refaster template
StringRules.StringJointech.picnic.errorprone.refasterrules.StringRulesRecipes$StringJoinRecipe - Refaster template
StringRules.StringJoinVarargstech.picnic.errorprone.refasterrules.StringRulesRecipes$StringJoinVarargsRecipe - Refaster template
StringRules.StringValueOfWithObjecttech.picnic.errorprone.refasterrules.StringRulesRecipes$StringValueOfWithObjectRecipe - Refaster template
StringRules.NewString3tech.picnic.errorprone.refasterrules.StringRulesRecipes$NewString3Recipe - Refaster template
StringRules.NewString1tech.picnic.errorprone.refasterrules.StringRulesRecipes$NewString1Recipe - Refaster template
StringRules.StringValueOftech.picnic.errorprone.refasterrules.StringRulesRecipes$StringValueOfRecipe - Refaster template
StringRules.StringSubstringtech.picnic.errorprone.refasterrules.StringRulesRecipes$StringSubstringRecipe - Refaster template
StringRules.Utf8EncodedLengthtech.picnic.errorprone.refasterrules.StringRulesRecipes$Utf8EncodedLengthRecipe - Refaster template
StringRules.MathMaxNegativeOneStringIndexOfMinusInttech.picnic.errorprone.refasterrules.StringRulesRecipes$MathMaxNegativeOneStringIndexOfMinusIntRecipe - Refaster template
StringRules.MathMaxNegativeOneStringIndexOfMinusIntWithInttech.picnic.errorprone.refasterrules.StringRulesRecipes$MathMaxNegativeOneStringIndexOfMinusIntWithIntRecipe - Refaster template
StringRules.MathMaxNegativeOneStringIndexOfMinusStringtech.picnic.errorprone.refasterrules.StringRulesRecipes$MathMaxNegativeOneStringIndexOfMinusStringRecipe - Refaster template
StringRules.MathMaxNegativeOneStringIndexOfMinusStringWithInttech.picnic.errorprone.refasterrules.StringRulesRecipes$MathMaxNegativeOneStringIndexOfMinusStringWithIntRecipe - Refaster template
StringRules.MathMaxNegativeOneStringLastIndexOfMinusInttech.picnic.errorprone.refasterrules.StringRulesRecipes$MathMaxNegativeOneStringLastIndexOfMinusIntRecipe - Refaster template
StringRules.MathMaxNegativeOneStringLastIndexOfMinusStringtech.picnic.errorprone.refasterrules.StringRulesRecipes$MathMaxNegativeOneStringLastIndexOfMinusStringRecipe - Refaster template
StringRules.StringLastIndexOfMinusOneInttech.picnic.errorprone.refasterrules.StringRulesRecipes$StringLastIndexOfMinusOneIntRecipe - Prefer
String#lastIndexOf(String, int)over less efficient alternativestech.picnic.errorprone.refasterrules.StringRulesRecipes$StringLastIndexOfMinusOneStringRecipe - Refaster template
StringRules.StringStartsWithtech.picnic.errorprone.refasterrules.StringRulesRecipes$StringStartsWithRecipe - Refaster template
StringRules.Formattedtech.picnic.errorprone.refasterrules.StringRulesRecipes$FormattedRecipe
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats