From 2667b06f09cf3e530dd358760155aabd063af9f1 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Sat, 28 Dec 2024 19:28:31 +0100 Subject: [PATCH 1/4] wip --- build.gradle.kts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 2a258eab5..a57b804b0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ plugins { id("org.openrewrite.build.recipe-library") version "latest.release" id("org.openrewrite.build.moderne-source-available-license") version "latest.release" + pmd } group = "org.openrewrite.recipe" @@ -37,3 +38,10 @@ dependencies { testRuntimeOnly("org.openrewrite:rewrite-java-17") testRuntimeOnly("com.google.code.findbugs:jsr305:latest.release") } +pmd { + isConsoleOutput = true + ruleSetFiles = files("${projectDir}/src/test/resources/pmd/pmd-rules.xml") +// rulesMinimumPriority = 5 +// rulesMinimumPriority = 1 +// ruleSets = listOf("category/java/errorprone.xml", "category/java/bestpractices.xml") +} From 7f1360bf3c38d510f20d83e32dcd7c8ee57dd7a3 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Sun, 29 Dec 2024 12:16:33 +0100 Subject: [PATCH 2/4] CommonStaticAnalysis --- build.gradle.kts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a57b804b0..1d7a98535 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("org.openrewrite.build.recipe-library") version "latest.release" id("org.openrewrite.build.moderne-source-available-license") version "latest.release" - pmd + id("org.openrewrite.rewrite") version("6.29.0") } group = "org.openrewrite.recipe" @@ -37,11 +37,10 @@ dependencies { testRuntimeOnly("org.openrewrite:rewrite-java-17") testRuntimeOnly("com.google.code.findbugs:jsr305:latest.release") + rewrite("org.openrewrite.recipe:rewrite-static-analysis:1.22.0") } -pmd { - isConsoleOutput = true - ruleSetFiles = files("${projectDir}/src/test/resources/pmd/pmd-rules.xml") -// rulesMinimumPriority = 5 -// rulesMinimumPriority = 1 -// ruleSets = listOf("category/java/errorprone.xml", "category/java/bestpractices.xml") + +rewrite { + activeRecipe("org.openrewrite.staticanalysis.CommonStaticAnalysis") + setExportDatatables(true) } From 858abfcf9e3d78e5cf07a6e488b5bc6b40587da9 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Sun, 29 Dec 2024 12:17:09 +0100 Subject: [PATCH 3/4] CommonStaticAnalysis --- build.gradle.kts | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 1d7a98535..87c20552c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,34 +10,29 @@ description = "The first Static Analysis and REMEDIATION tool" val rewriteVersion = rewriteRecipe.rewriteVersion.get() dependencies { compileOnly("org.projectlombok:lombok:latest.release") + compileOnly("com.google.errorprone:error_prone_core:2.+:with-dependencies") { + exclude("com.google.auto.service", "auto-service-annotations") + } + annotationProcessor("org.openrewrite:rewrite-templating:${rewriteVersion}") annotationProcessor("org.projectlombok:lombok:latest.release") - testImplementation("org.projectlombok:lombok:latest.release") - - implementation(platform("org.openrewrite:rewrite-bom:${rewriteVersion}")) - implementation("org.openrewrite:rewrite-java") + implementation("org.apache.commons:commons-text:latest.release") + implementation("org.openrewrite.meta:rewrite-analysis:${rewriteVersion}") + implementation("org.openrewrite:rewrite-csharp:${rewriteVersion}") implementation("org.openrewrite:rewrite-groovy:${rewriteVersion}") + implementation("org.openrewrite:rewrite-java") implementation("org.openrewrite:rewrite-kotlin:${rewriteVersion}") - implementation("org.openrewrite:rewrite-csharp:${rewriteVersion}") - implementation("org.openrewrite.meta:rewrite-analysis:${rewriteVersion}") - implementation("org.apache.commons:commons-text:latest.release") - - annotationProcessor("org.openrewrite:rewrite-templating:${rewriteVersion}") implementation("org.openrewrite:rewrite-templating:${rewriteVersion}") - compileOnly("com.google.errorprone:error_prone_core:2.+:with-dependencies") { - exclude("com.google.auto.service", "auto-service-annotations") - } - + implementation(platform("org.openrewrite:rewrite-bom:${rewriteVersion}")) + rewrite("org.openrewrite.recipe:rewrite-static-analysis:1.22.0") + testImplementation("com.google.code.gson:gson:latest.release") + testImplementation("junit:junit:4.13.2") testImplementation("org.jetbrains:annotations:24.+") + testImplementation("org.junit-pioneer:junit-pioneer:2.+") testImplementation("org.openrewrite:rewrite-groovy") testImplementation("org.openrewrite:rewrite-test") - testImplementation("org.junit-pioneer:junit-pioneer:2.+") - testImplementation("junit:junit:4.13.2") - - testImplementation("com.google.code.gson:gson:latest.release") - - testRuntimeOnly("org.openrewrite:rewrite-java-17") + testImplementation("org.projectlombok:lombok:latest.release") testRuntimeOnly("com.google.code.findbugs:jsr305:latest.release") - rewrite("org.openrewrite.recipe:rewrite-static-analysis:1.22.0") + testRuntimeOnly("org.openrewrite:rewrite-java-17") } rewrite { From 8fcb25c0043b5dabd2f7d98c4c1c39cb974aa0ee Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Sun, 29 Dec 2024 12:49:00 +0100 Subject: [PATCH 4/4] wip --- build.gradle.kts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 87c20552c..0c19949e2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,20 +1,20 @@ plugins { id("org.openrewrite.build.recipe-library") version "latest.release" id("org.openrewrite.build.moderne-source-available-license") version "latest.release" - id("org.openrewrite.rewrite") version("6.29.0") + id("org.openrewrite.rewrite") version("6.29.2") } +val rewriteVersion = rewriteRecipe.rewriteVersion.get() group = "org.openrewrite.recipe" description = "The first Static Analysis and REMEDIATION tool" -val rewriteVersion = rewriteRecipe.rewriteVersion.get() dependencies { + annotationProcessor("org.openrewrite:rewrite-templating:${rewriteVersion}") + annotationProcessor("org.projectlombok:lombok:latest.release") compileOnly("org.projectlombok:lombok:latest.release") compileOnly("com.google.errorprone:error_prone_core:2.+:with-dependencies") { exclude("com.google.auto.service", "auto-service-annotations") } - annotationProcessor("org.openrewrite:rewrite-templating:${rewriteVersion}") - annotationProcessor("org.projectlombok:lombok:latest.release") implementation("org.apache.commons:commons-text:latest.release") implementation("org.openrewrite.meta:rewrite-analysis:${rewriteVersion}") implementation("org.openrewrite:rewrite-csharp:${rewriteVersion}") @@ -23,7 +23,6 @@ dependencies { implementation("org.openrewrite:rewrite-kotlin:${rewriteVersion}") implementation("org.openrewrite:rewrite-templating:${rewriteVersion}") implementation(platform("org.openrewrite:rewrite-bom:${rewriteVersion}")) - rewrite("org.openrewrite.recipe:rewrite-static-analysis:1.22.0") testImplementation("com.google.code.gson:gson:latest.release") testImplementation("junit:junit:4.13.2") testImplementation("org.jetbrains:annotations:24.+") @@ -33,9 +32,14 @@ dependencies { testImplementation("org.projectlombok:lombok:latest.release") testRuntimeOnly("com.google.code.findbugs:jsr305:latest.release") testRuntimeOnly("org.openrewrite:rewrite-java-17") + rewrite("org.openrewrite.recipe:rewrite-static-analysis:1.22.0") +} +repositories { + mavenCentral() } - rewrite { activeRecipe("org.openrewrite.staticanalysis.CommonStaticAnalysis") +// activeRecipe("org.openrewrite.staticanalysis.EqualsAvoidsNull") // not found +// activeRecipe("org.openrewrite.java.RemoveObjectsIsNull") // found setExportDatatables(true) }