From 700c150e3342ac2128fad8c37072b85193cb539f Mon Sep 17 00:00:00 2001 From: acasado Date: Thu, 21 May 2026 12:27:44 +0200 Subject: [PATCH] fix(autofix-sonar): refresh OpenRewrite plugin and recipes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bump rewrite-maven-plugin 5.46.0 → 6.38.0 - java:S1155: rename UseCollectionIsEmpty → IsEmptyCallOnCollections (renamed upstream in rewrite-static-analysis) - java:S2864: drop UseMapEntrySetIterator (removed upstream) Without this Step 4b crashes on those rules with NoSuchRecipe errors. --- src/autofix_sonar.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/autofix_sonar.rs b/src/autofix_sonar.rs index f254366..e8ffc61 100644 --- a/src/autofix_sonar.rs +++ b/src/autofix_sonar.rs @@ -26,7 +26,7 @@ use crate::sonar::{self, Issue}; /// Version pin for the Maven rewrite plugin. Kept current but conservative; /// bump in tandem with tested recipe versions below. -const REWRITE_PLUGIN_GAV: &str = "org.openrewrite.maven:rewrite-maven-plugin:5.46.0"; +const REWRITE_PLUGIN_GAV: &str = "org.openrewrite.maven:rewrite-maven-plugin:6.38.0"; /// OpenRewrite recipe descriptor. `artifact` is the GAV coordinate that ships /// the recipe; we collect the union for the plugin's `recipeArtifactCoordinates`. @@ -104,7 +104,7 @@ pub const RULE_TO_RECIPES: &[(&str, &[Recipe])] = &[ ( "java:S1155", &[Recipe { - name: "org.openrewrite.staticanalysis.UseCollectionIsEmpty", + name: "org.openrewrite.staticanalysis.IsEmptyCallOnCollections", artifact: "org.openrewrite.recipe:rewrite-static-analysis:RELEASE", }], ), @@ -163,15 +163,7 @@ pub const RULE_TO_RECIPES: &[(&str, &[Recipe])] = &[ name: "org.openrewrite.staticanalysis.FinalizePrivateFields", artifact: "org.openrewrite.recipe:rewrite-static-analysis:RELEASE", }], - ), - // java:S2864 — Iterate over entrySet instead of keySet+get. - ( - "java:S2864", - &[Recipe { - name: "org.openrewrite.staticanalysis.UseMapEntrySetIterator", - artifact: "org.openrewrite.recipe:rewrite-static-analysis:RELEASE", - }], - ), + ), ]; /// Returns Some(recipes) if this rule is autofix-eligible, else None.