From e34bcf0b80ddd132eaae4218a5bd6bd93be7a516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonathan=20Schn=C3=A9ider?= <jkschneider@gmail.com>
Date: Tue, 26 Sep 2023 18:47:13 +0000
Subject: [PATCH] refactor: Spaces

Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.java.format.Spaces?organizationId=T3BlblJld3JpdGU%3D

Co-authored-by: Moderne <team@moderne.io>
---
 .../gradle/AbstractRewriteTask.java           |  4 +-
 .../gradle/DefaultRewriteExtension.java       | 24 +++---
 .../gradle/DelegatingProjectParser.java       |  2 +-
 .../gradle/SanitizedMarkerPrinter.java        |  4 +-
 .../org/openrewrite/gradle/TimeUtils.java     | 18 ++---
 .../openrewrite/gradle/GradleProjectSpec.kt   | 62 +++++++-------
 .../openrewrite/gradle/RewriteDiscoverTest.kt |  2 +-
 .../openrewrite/gradle/RewriteDryRunTest.kt   | 12 +--
 .../openrewrite/gradle/RewritePluginTest.kt   |  2 +-
 .../org/openrewrite/gradle/RewriteRunTest.kt  | 80 +++++++++----------
 scripts/spring-petclinic-test.init.gradle     | 38 ++++-----
 11 files changed, 124 insertions(+), 124 deletions(-)

diff --git a/plugin/src/main/java/org/openrewrite/gradle/AbstractRewriteTask.java b/plugin/src/main/java/org/openrewrite/gradle/AbstractRewriteTask.java
index 8ac585073..ddecf1501 100755
--- a/plugin/src/main/java/org/openrewrite/gradle/AbstractRewriteTask.java
+++ b/plugin/src/main/java/org/openrewrite/gradle/AbstractRewriteTask.java
@@ -57,8 +57,8 @@ public boolean isDumpGcActivity() {
 
     @Internal
     protected <T extends GradleProjectParser> T getProjectParser() {
-        if(gpp == null) {
-            if(extension == null) {
+        if (gpp == null) {
+            if (extension == null) {
                 throw new IllegalArgumentException("Must configure extension");
             }
             if (resolveDependenciesTask == null) {
diff --git a/plugin/src/main/java/org/openrewrite/gradle/DefaultRewriteExtension.java b/plugin/src/main/java/org/openrewrite/gradle/DefaultRewriteExtension.java
index 5f31d93b4..a8856d872 100644
--- a/plugin/src/main/java/org/openrewrite/gradle/DefaultRewriteExtension.java
+++ b/plugin/src/main/java/org/openrewrite/gradle/DefaultRewriteExtension.java
@@ -38,7 +38,7 @@ public class DefaultRewriteExtension implements RewriteExtension {
     private File configFile;
 
     private Provider<File> checkstyleConfigProvider;
-    private Provider<Map<String,Object>> checkstylePropertiesProvider;
+    private Provider<Map<String, Object>> checkstylePropertiesProvider;
     private File checkstyleConfigFile;
     private String metricsUri = magicalMetricsLogString;
     private boolean enableExperimentalGradleBuildScriptParsing = true;
@@ -98,10 +98,10 @@ public void setCheckstyleConfigFile(File configFile) {
     @Override
     @Nullable
     public File getCheckstyleConfigFile() {
-        if(checkstyleConfigFile == null && checkstyleConfigProvider != null) {
+        if (checkstyleConfigFile == null && checkstyleConfigProvider != null) {
             try {
                 return checkstyleConfigProvider.get();
-            } catch(Exception e) {
+            } catch (Exception e) {
                 return null;
             }
         }
@@ -110,7 +110,7 @@ public File getCheckstyleConfigFile() {
 
     @Override
     public Map<String, Object> getCheckstyleProperties() {
-        if(checkstyleConfigProvider == null) {
+        if (checkstyleConfigProvider == null) {
             return emptyMap();
         }
         return checkstylePropertiesProvider.get();
@@ -195,11 +195,11 @@ public List<String> getActiveRecipes() {
     }
 
     private Properties getVersionProps() {
-        if(versionProps == null) {
-            try(InputStream is = DefaultRewriteExtension.class.getResourceAsStream("/rewrite/versions.properties")) {
+        if (versionProps == null) {
+            try (InputStream is = DefaultRewriteExtension.class.getResourceAsStream("/rewrite/versions.properties")) {
                 versionProps = new Properties();
                 versionProps.load(is);
-            } catch(IOException e) {
+            } catch (IOException e) {
                 throw new RuntimeException(e);
             }
         }
@@ -211,7 +211,7 @@ private Properties getVersionProps() {
      */
     @Override
     public String getRewriteVersion() {
-        if(rewriteVersion == null) {
+        if (rewriteVersion == null) {
             return getVersionProps().getProperty("org.openrewrite:rewrite-core");
         }
         return rewriteVersion;
@@ -219,7 +219,7 @@ public String getRewriteVersion() {
 
     @Override
     public String getRewritePolyglotVersion() {
-        if(rewriteVersion == null) {
+        if (rewriteVersion == null) {
             return getVersionProps().getProperty("org.openrewrite:rewrite-polyglot");
         }
         return rewriteVersion;
@@ -228,7 +228,7 @@ public String getRewritePolyglotVersion() {
     private String rewriteGradleModelVersion;
     @Override
     public String getRewriteGradleModelVersion() {
-        if(rewriteGradleModelVersion == null) {
+        if (rewriteGradleModelVersion == null) {
             rewriteGradleModelVersion = getVersionProps().getProperty("org.openrewrite.gradle.tooling:model");
         }
         return rewriteGradleModelVersion;
@@ -237,7 +237,7 @@ public String getRewriteGradleModelVersion() {
     private String rewriteKotlinVersion;
     @Override
     public String getRewriteKotlinVersion() {
-        if(rewriteKotlinVersion == null) {
+        if (rewriteKotlinVersion == null) {
             rewriteKotlinVersion = getVersionProps().getProperty("org.openrewrite:rewrite-kotlin");
         }
         return rewriteKotlinVersion;
@@ -384,7 +384,7 @@ public String getJacksonModuleKotlinVersion() {
 
     @Override
     public boolean getThrowOnParseFailures() {
-        if(project.getProperties().containsKey("rewrite.throwOnParseFailures")) {
+        if (project.getProperties().containsKey("rewrite.throwOnParseFailures")) {
             return true;
         }
         return throwOnParseFailures;
diff --git a/plugin/src/main/java/org/openrewrite/gradle/DelegatingProjectParser.java b/plugin/src/main/java/org/openrewrite/gradle/DelegatingProjectParser.java
index 77ae7fac4..2b33d8726 100755
--- a/plugin/src/main/java/org/openrewrite/gradle/DelegatingProjectParser.java
+++ b/plugin/src/main/java/org/openrewrite/gradle/DelegatingProjectParser.java
@@ -54,7 +54,7 @@ public DelegatingProjectParser(Project project, RewriteExtension extension, Set<
                     .getResource("/org/openrewrite/gradle/isolated/DefaultProjectParser.class")
                     .toString());
             classpathUrls.add(currentJar);
-            if(rewriteClassLoader == null || !classpathUrls.equals(rewriteClasspath)) {
+            if (rewriteClassLoader == null || !classpathUrls.equals(rewriteClasspath)) {
                 if (rewriteClassLoader != null) {
                     rewriteClassLoader.close();
                 }
diff --git a/plugin/src/main/java/org/openrewrite/gradle/SanitizedMarkerPrinter.java b/plugin/src/main/java/org/openrewrite/gradle/SanitizedMarkerPrinter.java
index 0d89b75af..131c01f41 100644
--- a/plugin/src/main/java/org/openrewrite/gradle/SanitizedMarkerPrinter.java
+++ b/plugin/src/main/java/org/openrewrite/gradle/SanitizedMarkerPrinter.java
@@ -29,7 +29,7 @@
 public class SanitizedMarkerPrinter implements PrintOutputCapture.MarkerPrinter {
     @Override
     public String beforeSyntax(Marker marker, Cursor cursor, UnaryOperator<String> commentWrapper) {
-        if(marker instanceof SearchResult) {
+        if (marker instanceof SearchResult) {
             return DEFAULT.beforeSyntax(marker, cursor, commentWrapper);
         }
         return "";
@@ -37,7 +37,7 @@ public String beforeSyntax(Marker marker, Cursor cursor, UnaryOperator<String> c
 
     @Override
     public String afterSyntax(Marker marker, Cursor cursor, UnaryOperator<String> commentWrapper) {
-        if(marker instanceof SearchResult) {
+        if (marker instanceof SearchResult) {
             return DEFAULT.afterSyntax(marker, cursor, commentWrapper);
         }
         return "";
diff --git a/plugin/src/main/java/org/openrewrite/gradle/TimeUtils.java b/plugin/src/main/java/org/openrewrite/gradle/TimeUtils.java
index 063101748..271c5194b 100644
--- a/plugin/src/main/java/org/openrewrite/gradle/TimeUtils.java
+++ b/plugin/src/main/java/org/openrewrite/gradle/TimeUtils.java
@@ -27,39 +27,39 @@ public static String prettyPrint(Duration duration) {
         StringBuilder result = new StringBuilder();
         long days = duration.getSeconds() / SECONDS_PER_DAY;
         boolean startedPrinting = false;
-        if(days > 0) {
+        if (days > 0) {
             startedPrinting = true;
             result.append(days);
             result.append(" day");
-            if(days != 1) {
+            if (days != 1) {
                 result.append("s");
             }
             result.append(" ");
         }
 
-        long hours =  duration.toHours() % 24;
-        if(startedPrinting || hours > 0) {
+        long hours = duration.toHours() % 24;
+        if (startedPrinting || hours > 0) {
             startedPrinting = true;
             result.append(hours);
             result.append(" hour");
-            if(hours != 1) {
+            if (hours != 1) {
                 result.append("s");
             }
             result.append(" ");
         }
 
         long minutes = (duration.getSeconds() / SECONDS_PER_MINUTE) % MINUTES_PER_HOUR;
-        if(startedPrinting || minutes > 0) {
+        if (startedPrinting || minutes > 0) {
             result.append(minutes);
             result.append(" minute");
-            if(minutes != 1) {
+            if (minutes != 1) {
                 result.append("s");
             }
             result.append(" ");
         }
 
         long seconds = duration.getSeconds() % SECONDS_PER_MINUTE;
-        if(startedPrinting || seconds > 0) {
+        if (startedPrinting || seconds > 0) {
             result.append(seconds);
             result.append(" second");
             if (seconds != 1) {
@@ -71,7 +71,7 @@ public static String prettyPrint(Duration duration) {
         long millis = duration.getNano() / 1000_000;
         result.append(millis);
         result.append(" millisecond");
-        if(millis != 1) {
+        if (millis != 1) {
             result.append("s");
         }
 
diff --git a/plugin/src/main/kotlin/org/openrewrite/gradle/GradleProjectSpec.kt b/plugin/src/main/kotlin/org/openrewrite/gradle/GradleProjectSpec.kt
index a0acd9647..6b147d45e 100644
--- a/plugin/src/main/kotlin/org/openrewrite/gradle/GradleProjectSpec.kt
+++ b/plugin/src/main/kotlin/org/openrewrite/gradle/GradleProjectSpec.kt
@@ -77,51 +77,51 @@ class GradleProjectSpec(
     fun build(): GradleProjectSpec {
         dir.mkdirs()
 
-        if(settingsGradle != null) {
+        if (settingsGradle != null) {
             File(dir, "settings.gradle").writeText(settingsGradle!!)
         }
 
-        if(groovyBuildScript != null) {
+        if (groovyBuildScript != null) {
             File(dir, "build.gradle").writeText(groovyBuildScript!!)
         }
 
-        if(rewriteYaml != null) {
+        if (rewriteYaml != null) {
             File(dir, "rewrite.yml").writeText(rewriteYaml!!)
         }
 
-        if(checkstyleXml != null) {
-            File(dir, "config/checkstyle/checkstyle.xml").apply {
+        if (checkstyleXml != null) {
+            File(dir, "config/checkstyle/checkstyle.xml").apply{ 
                 parentFile.mkdirs()
                 writeText(checkstyleXml!!)
             }
         }
 
-        for(props in propertiesFiles.entries) {
-            File(dir, props.key).apply {
+        for (props in propertiesFiles.entries) {
+            File(dir, props.key).apply{ 
                 parentFile.mkdirs()
                 writeText(props.value)
             }
         }
 
-        for(text in textFiles.entries) {
-            File(dir, text.key).apply {
+        for (text in textFiles.entries) {
+            File(dir, text.key).apply{ 
                 parentFile.mkdirs()
                 writeText(text.value)
             }
         }
 
-        for(sourceSet in sourceSets) {
+        for (sourceSet in sourceSets) {
             sourceSet.build(File(dir, "src"))
         }
 
         val settings = File(dir, "settings.gradle")
         val settingsText = "rootProject.name = \"${dir.name}\"\n"
-        if(subprojects.isEmpty()) {
+        if (subprojects.isEmpty()) {
             settings.writeText("rootProject.name = \"${dir.name}\"\n")
         } else {
-            val subprojectsDeclarations = subprojects.joinToString("\n") { subproject -> "include('${subproject.dir.name}')" }
+            val subprojectsDeclarations = subprojects.joinToString("\n") { subproject  ->  "include('${subproject.dir.name}')" }
             settings.writeText(settingsText + subprojectsDeclarations)
-            for(subproject in subprojects) {
+            for (subproject in subprojects) {
                 subproject.build()
             }
         }
@@ -161,8 +161,8 @@ class GradleSourceSetSpec(
     @Suppress("RegExpSimplifiable")
     fun build(dir: File): GradleSourceSetSpec {
         dir.mkdirs()
-        for(javaSource in javaSources) {
-            val peckage = if(javaSource.startsWith("package")) {
+        for (javaSource in javaSources) {
+            val peckage = if (javaSource.startsWith("package")) {
                 "package\\s+([a-zA-Z0-9.]+);".toRegex(RegexOption.MULTILINE)
                     .find(javaSource)!!
                     .groupValues[1]
@@ -170,18 +170,18 @@ class GradleSourceSetSpec(
                 ""
             }.replace(".", "/")
             val clazz = ".*(class|interface|enum)\\s+([a-zA-Z0-9-_]+)".toRegex(RegexOption.MULTILINE).find(javaSource)!!.groupValues[2]
-            val path = if(peckage.isEmpty()) {
+            val path = if (peckage.isEmpty()) {
                 "$name/java/$clazz.java"
             } else {
                 "$name/java/$peckage/$clazz.java"
             }
-            File(dir, path).apply {
+            File(dir, path).apply{ 
                 parentFile.mkdirs()
                 writeText(javaSource)
             }
         }
-        for(kotlinSource in kotlinSources) {
-            val peckage = if(kotlinSource.startsWith("package")) {
+        for (kotlinSource in kotlinSources) {
+            val peckage = if (kotlinSource.startsWith("package")) {
                 "package\\s+([a-zA-Z0-9.]+)".toRegex(RegexOption.MULTILINE)
                     .find(kotlinSource)!!
                     .groupValues[1]
@@ -189,18 +189,18 @@ class GradleSourceSetSpec(
                 ""
             }.replace(".", "/")
             val clazz = ".*(class|interface|enum)\\s+([a-zA-Z0-9-_]+)".toRegex(RegexOption.MULTILINE).find(kotlinSource)!!.groupValues[2]
-            val path = if(peckage.isEmpty()) {
+            val path = if (peckage.isEmpty()) {
                 "$name/kotlin/$clazz.kt"
             } else {
                 "$name/kotlin/$peckage/$clazz.kt"
             }
-            File(dir, path).apply {
+            File(dir, path).apply{ 
                 parentFile.mkdirs()
                 writeText(kotlinSource)
             }
         }
-        for(groovySource in groovyClasses) {
-            val peckage = if(groovySource.startsWith("package")) {
+        for (groovySource in groovyClasses) {
+            val peckage = if (groovySource.startsWith("package")) {
                 "package\\s+([a-zA-Z0-9.]+);?".toRegex(RegexOption.MULTILINE)
                     .find(groovySource)!!
                     .groupValues[1]
@@ -208,27 +208,27 @@ class GradleSourceSetSpec(
                 ""
             }.replace(".", "/")
             val clazz = ".*(class|interface|enum)\\s+([a-zA-Z0-9-_]+)".toRegex(RegexOption.MULTILINE).find(groovySource)!!.groupValues[2]
-            val path = if(peckage.isEmpty()) {
+            val path = if (peckage.isEmpty()) {
                 "$name/groovy/$clazz.groovy"
             } else {
                 "$name/groovy/$peckage/$clazz.groovy"
             }
-            File(dir, path).apply {
+            File(dir, path).apply{ 
                 parentFile.mkdirs()
                 writeText(groovySource)
             }
         }
-        if(propertiesFiles.isNotEmpty()) {
-            for(props in propertiesFiles.entries) {
-                File(dir, "$name/resources/${props.key}").apply {
+        if (propertiesFiles.isNotEmpty()) {
+            for (props in propertiesFiles.entries) {
+                File(dir, "$name/resources/${props.key}").apply{ 
                     parentFile.mkdirs()
                     writeText(props.value)
                 }
             }
         }
-        if(yamlFiles.isNotEmpty()) {
-            for(yaml in yamlFiles.entries) {
-                File(dir, "$name/resources/${yaml.key}").apply {
+        if (yamlFiles.isNotEmpty()) {
+            for (yaml in yamlFiles.entries) {
+                File(dir, "$name/resources/${yaml.key}").apply{ 
                     parentFile.mkdirs()
                     writeText(yaml.value)
                 }
diff --git a/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDiscoverTest.kt b/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDiscoverTest.kt
index f2bd14a59..0e17b2d89 100644
--- a/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDiscoverTest.kt
+++ b/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDiscoverTest.kt
@@ -28,7 +28,7 @@ class RewriteDiscoverTest : RewritePluginTest {
     fun `rewriteDiscover prints recipes from external dependencies`(
         @TempDir projectDir: File
     ) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             buildGradle("""
                 plugins {
                     id("java")
diff --git a/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDryRunTest.kt b/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDryRunTest.kt
index 7a2d37da7..254e17772 100644
--- a/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDryRunTest.kt
+++ b/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteDryRunTest.kt
@@ -35,7 +35,7 @@ class RewriteDryRunTest : RewritePluginTest {
                 }public static void main(String[] args) {   sayGoodbye(); }
             }
         """.trimIndent()
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/recipe
                 name: org.openrewrite.gradle.SayHello
@@ -65,7 +65,7 @@ class RewriteDryRunTest : RewritePluginTest {
                     activeRecipe("org.openrewrite.gradle.SayHello", "org.openrewrite.java.format.AutoFormat")
                 }
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 java(helloWorld)
             }
         }
@@ -82,7 +82,7 @@ class RewriteDryRunTest : RewritePluginTest {
     fun `A recipe with optional configuration can be activated directly`(
         @TempDir projectDir: File
     ) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             buildGradle("""
                 plugins {
                     id("java")
@@ -97,7 +97,7 @@ class RewriteDryRunTest : RewritePluginTest {
                     }
                 }
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 java("""
                     package org.openrewrite.before;
                 
@@ -127,7 +127,7 @@ class RewriteDryRunTest : RewritePluginTest {
     @DisabledIf("lessThanGradle6_1")
     @Test
     fun testMultiplatform(@TempDir projectDir: File) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             buildGradle("""
                 plugins {
                     id("java")
@@ -177,7 +177,7 @@ class RewriteDryRunTest : RewritePluginTest {
                 }
                 rootProject.name = "example"
             """)
-            sourceSet("commonMain") {
+            sourceSet("commonMain") { 
                 kotlin("""
                     class HelloWorld {
                         fun sayHello() {
diff --git a/plugin/src/test/kotlin/org/openrewrite/gradle/RewritePluginTest.kt b/plugin/src/test/kotlin/org/openrewrite/gradle/RewritePluginTest.kt
index 7ff56fb66..d2b7f9e9b 100644
--- a/plugin/src/test/kotlin/org/openrewrite/gradle/RewritePluginTest.kt
+++ b/plugin/src/test/kotlin/org/openrewrite/gradle/RewritePluginTest.kt
@@ -29,7 +29,7 @@ interface RewritePluginTest {
         GradleRunner.create()
             .withDebug(ManagementFactory.getRuntimeMXBean().inputArguments.toString().indexOf("-agentlib:jdwp") > 0)
             .withProjectDir(testDir)
-            .apply {
+            .apply{ 
                 if (gradleVersion != null) {
                     withGradleVersion(gradleVersion)
                 }
diff --git a/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteRunTest.kt b/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteRunTest.kt
index fd3052a85..d77f32793 100644
--- a/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteRunTest.kt
+++ b/plugin/src/test/kotlin/org/openrewrite/gradle/RewriteRunTest.kt
@@ -40,7 +40,7 @@ class RewriteRunTest : RewritePluginTest {
         // Gradle provides no control over how it arbitrarily orders its classpath
         // So even if isolation isn't working at all, this could pass if it happens to put the rewrite's required version
         // of jackson first on the classpath.
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             buildGradle("""
                 buildscript {
                     repositories {
@@ -69,7 +69,7 @@ class RewriteRunTest : RewritePluginTest {
                     activeRecipe("org.openrewrite.java.format.AutoFormat")
                 }
             """)
-            sourceSet("test") {
+            sourceSet("test") { 
                 java("""
                     package com.foo;
                     
@@ -89,7 +89,7 @@ class RewriteRunTest : RewritePluginTest {
     fun `rewriteRun will alter the source file according to the provided active recipe`(
         @TempDir projectDir: File
     ) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/recipe
                 name: org.openrewrite.gradle.SayHello
@@ -119,7 +119,7 @@ class RewriteRunTest : RewritePluginTest {
                     activeRecipe("org.openrewrite.gradle.SayHello", "org.openrewrite.java.format.AutoFormat")
                 }
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 java("""
                     package org.openrewrite.before;
                     
@@ -170,7 +170,7 @@ class RewriteRunTest : RewritePluginTest {
                     public void passes() { }
                 }
         """.trimIndent()
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/recipe
                 name: org.openrewrite.FormatAndAddProperty
@@ -212,8 +212,8 @@ class RewriteRunTest : RewritePluginTest {
                     }
                 }
             """)
-            subproject("a") {
-                sourceSet("test") {
+            subproject("a") { 
+                sourceSet("test") { 
                     java("""
                         package com.foo;
             
@@ -228,8 +228,8 @@ class RewriteRunTest : RewritePluginTest {
                     propertiesFile("test.properties", "foo=baz\n")
                 }
             }
-            subproject("b") {
-                sourceSet("test") {
+            subproject("b") { 
+                sourceSet("test") { 
                     java(bTestClassExpected)
                 }
             }
@@ -265,7 +265,7 @@ class RewriteRunTest : RewritePluginTest {
     fun `Checkstyle configuration is applied as a style`(
         @TempDir projectDir: File
     ) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             checkstyleXml("""
                 <!DOCTYPE module PUBLIC
                     "-//Checkstyle//DTD Checkstyle Configuration 1.2//EN"
@@ -299,7 +299,7 @@ class RewriteRunTest : RewritePluginTest {
                     rewrite("org.openrewrite.recipe:rewrite-static-analysis:1.0.4")
                 }
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 java("""
                     package com.foo;
                     
@@ -314,7 +314,7 @@ class RewriteRunTest : RewritePluginTest {
             }
         }
 
-        val result = runGradle(projectDir,"rewriteRun")
+        val result = runGradle(projectDir, "rewriteRun")
         val rewriteRunResult = result.task(":rewriteRun")!!
 
         assertThat(rewriteRunResult.outcome).isEqualTo(TaskOutcome.SUCCESS)
@@ -338,7 +338,7 @@ class RewriteRunTest : RewritePluginTest {
     fun `can apply non-java recipe to files inside and outside of java resources directories`(
         @TempDir projectDir: File
     ) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/recipe
                 name: com.example.RenameSam
@@ -368,7 +368,7 @@ class RewriteRunTest : RewritePluginTest {
                 }
             """)
             propertiesFile("outside-of-sourceset.properties", "sam=true\n")
-            sourceSet("main") {
+            sourceSet("main") { 
                 propertiesFile("in-sourceset.properties", "sam=true\n")
             }
         }
@@ -385,7 +385,7 @@ class RewriteRunTest : RewritePluginTest {
     fun `Recipes that generate sources have those sources written out to disk successfully`(
         @TempDir projectDir: File
     ) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/recipe
                 name: org.openrewrite.test.AddGradleWrapper
@@ -442,7 +442,7 @@ class RewriteRunTest : RewritePluginTest {
     fun gradleDependencyManagement(
         @TempDir projectDir: File
     ) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/recipe
                 name: org.openrewrite.test.RemoveJacksonCore
@@ -518,7 +518,7 @@ class RewriteRunTest : RewritePluginTest {
 
     @Test
     fun mergeConfiguredAndAutodetectedStyles(@TempDir projectDir: File) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             propertiesFile("gradle.properties", "systemProp.rewrite.activeStyles=org.openrewrite.testStyle")
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/style
@@ -545,7 +545,7 @@ class RewriteRunTest : RewritePluginTest {
                     activeRecipe("org.openrewrite.java.format.AutoFormat")
                 }
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 // Uses spaces, to be converted to tabs
                 java("""
                     package com.foo;
@@ -588,7 +588,7 @@ class RewriteRunTest : RewritePluginTest {
 
     @Test
     fun reformatToIntelliJStyle(@TempDir projectDir: File) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             buildGradle("""
                 plugins {
                     id("java")
@@ -608,7 +608,7 @@ class RewriteRunTest : RewritePluginTest {
                     activeStyle("org.openrewrite.java.IntelliJ")
                 }
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 java("""
                     package com.foo;
                     
@@ -663,7 +663,7 @@ class RewriteRunTest : RewritePluginTest {
 
     @Test
     fun groovySourceGetsTypesFromJavaSource(@TempDir projectDir: File) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
                 type: specs.openrewrite.org/v1beta/recipe
                 name: org.openrewrite.test.FindA
@@ -696,7 +696,7 @@ class RewriteRunTest : RewritePluginTest {
                 }
                 
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 java("""
                     package com.foo;
                     
@@ -738,7 +738,7 @@ class RewriteRunTest : RewritePluginTest {
     @DisabledIf("lessThanGradle6_1")
     @Test
     fun kotlinSource(@TempDir projectDir: File) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             buildGradle(
                 """
                 plugins {
@@ -765,7 +765,7 @@ class RewriteRunTest : RewritePluginTest {
                   - org.openrewrite.java.search.FindTypes:
                       fullyQualifiedTypeName: kotlin.String
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 kotlin("""
                     package com.foo
                     
@@ -789,7 +789,7 @@ class RewriteRunTest : RewritePluginTest {
     @Issue("https://github.com/openrewrite/rewrite-gradle-plugin/issues/128")
     @Test
     fun deleteEmptyDirectory(@TempDir projectDir: File) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             rewriteYaml("""
               type: specs.openrewrite.org/v1beta/recipe
               name: org.openrewrite.test.DeleteFoo
@@ -836,26 +836,26 @@ class RewriteRunTest : RewritePluginTest {
 
     @Test
     fun `build root and repository root do not need to be the same`(@TempDir repositoryRoot: File) {
-        repositoryRoot.apply {
-            resolve(".git").apply {
+        repositoryRoot.apply{ 
+            resolve(".git").apply{ 
                 mkdirs()
-                resolve("HEAD").apply {
+                resolve("HEAD").apply{ 
                     createNewFile()
                     writeText("ref: refs/heads/main")
                 }
-                resolve("objects").apply {
+                resolve("objects").apply{ 
                     mkdir()
                 }
-                resolve("refs").apply {
+                resolve("refs").apply{ 
                     mkdir()
                 }
-                resolve("reftable").apply {
+                resolve("reftable").apply{ 
                     mkdir()
                 }
             }
         }
-        val buildRoot = repositoryRoot.resolve("test-project").apply { mkdirs() }
-        gradleProject(buildRoot) {
+        val buildRoot = repositoryRoot.resolve("test-project").apply{  mkdirs() }
+        gradleProject(buildRoot) { 
             buildGradle("""
                 plugins {
                     id("java")
@@ -874,7 +874,7 @@ class RewriteRunTest : RewritePluginTest {
                     activeRecipe("org.openrewrite.java.format.AutoFormat")
                 }
             """)
-            sourceSet("main") {
+            sourceSet("main") { 
                 java("""
                     package org.openrewrite.before;
                 
@@ -918,20 +918,20 @@ class RewriteRunTest : RewritePluginTest {
     @Issue("https://github.com/openrewrite/rewrite-gradle-plugin/issues/176")
     @Test
     fun runRecipeFromProjectDependency(@TempDir projectDir: File) {
-        gradleProject(projectDir) {
+        gradleProject(projectDir) { 
             settingsGradle("""
                 rootProject.name = 'multi-project-recipe'
 
                 include("recipe")
                 include("product")
             """)
-            subproject("recipe") {
+            subproject("recipe") { 
                 buildGradle("""
                     plugins { 
                         id("java")
                     }
                 """)
-                sourceSet("main") {
+                sourceSet("main") { 
                     yamlFile("META-INF/rewrite/recipe.yml", """
                         type: specs.openrewrite.org/v1beta/recipe
                         name: com.example.TextToSam
@@ -947,7 +947,7 @@ class RewriteRunTest : RewritePluginTest {
                     """)
                 }
             }
-            subproject("product") {
+            subproject("product") { 
                 buildGradle("""
                     plugins {
                         id("org.openrewrite.rewrite")
@@ -988,7 +988,7 @@ class RewriteRunTest : RewritePluginTest {
 
     @Test
     fun overlappingSourceSet(@TempDir buildRoot: File) {
-        gradleProject(buildRoot) {
+        gradleProject(buildRoot) { 
             rewriteYaml("""
               type: specs.openrewrite.org/v1beta/recipe
               name: org.openrewrite.test.FindSneaky
@@ -1026,7 +1026,7 @@ class RewriteRunTest : RewritePluginTest {
                     testImplementation("org.projectlombok:lombok:latest.release")
                 }
             """)
-            sourceSet("test") {
+            sourceSet("test") { 
                 java("""
                     package com.foo;
                     
diff --git a/scripts/spring-petclinic-test.init.gradle b/scripts/spring-petclinic-test.init.gradle
index 6e3e02dd1..93d09cc05 100755
--- a/scripts/spring-petclinic-test.init.gradle
+++ b/scripts/spring-petclinic-test.init.gradle
@@ -1,62 +1,62 @@
-initscript {
-    repositories {
-        repositories {
+initscript{
+    repositories{
+        repositories{
             mavenLocal()
-            maven {
+            maven{
                 url = uri("https://oss.sonatype.org/content/repositories/snapshots")
             }
             mavenCentral()
         }
     }
-    dependencies {
+    dependencies{
         classpath("org.openrewrite:plugin:latest.integration")
     }
 }
 
-projectsEvaluated {
-    rootProject {
-        apply plugin: org.openrewrite.gradle.RewritePlugin
+projectsEvaluated{
+    rootProject{
+        applyplugin: org.openrewrite.gradle.RewritePlugin
 
-        repositories {
+        repositories{
             mavenLocal()
-            maven {
+            maven{
                 url = uri("https://oss.sonatype.org/content/repositories/snapshots")
             }
             mavenCentral()
         }
 
-        rewrite {
+        rewrite{
             failOnInvalidActiveRecipes = true
             activeRecipe("org.openrewrite.java.spring.boot2.SpringBoot1To2Migration")
         }
 
-        dependencies {
+        dependencies{
             rewrite("org.openrewrite.recipe:rewrite-spring:latest.integration")
         }
 
         tasks.create("validateRewrite") {
              dependsOn(tasks.getByName("rewriteDryRun"))
-             doLast {
+             doLast{
                  File patchFile = file("build/reports/rewrite/rewrite.patch")
-                 if(!patchFile.exists()) {
+                 if (!patchFile.exists()) {
                      throw new RuntimeException("Running rewrite dryRun failed to produce a patch report at " + patchFile.absolutePath);
                  }
 
                  // Spot-check for some expected changes
                  String patch = patchFile.text
-                 if(!patch.contains('+++ b/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java')) {
+                 if (!patch.contains('+++ b/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java')) {
                     throw new RuntimeException("Expected the recipe to make changes to OwnerController.java");
                  }
-                 if(!patch.contains('-    @RequestMapping(value = "/owners/what")\n+    @GetMapping("/owners/what")')) {
+                 if (!patch.contains('-    @RequestMapping(value = "/owners/what")\n+    @GetMapping("/owners/what")')) {
                      throw new RuntimeException("Expected the recipe to change @RequestMapping into @GetMapping")
                  }
-                 if(!patch.contains('-    public JCacheManagerCustomizer cacheManagerCustomizer() {\n+    JCacheManagerCustomizer cacheManagerCustomizer() {')) {
+                 if (!patch.contains('-    public JCacheManagerCustomizer cacheManagerCustomizer() {\n+    JCacheManagerCustomizer cacheManagerCustomizer() {')) {
                      throw new RuntimeException("Expected the recipe to reduce visibility of bean methods that don't need to be public")
                  }
-                 if(!patch.contains('-@RunWith(MockitoJUnitRunner.class)\n+@ExtendWith(MockitoExtension.class)\n public class PetTypeFormatterTests {')) {
+                 if (!patch.contains('-@RunWith(MockitoJUnitRunner.class)\n+@ExtendWith(MockitoExtension.class)\n public class PetTypeFormatterTests {')) {
                      throw new RuntimeException("Expected the recipe to swap MockitoJUnitRunner for MockitoExtension")
                  }
-                 if(!patch.contains('-spring.datasource.schema=classpath*:db/${database}/schema.sql\n' +
+                 if (!patch.contains('-spring.datasource.schema=classpath*:db/${database}/schema.sql\n' +
                          '-spring.datasource.data=classpath*:db/${database}/data.sql\n' +
                          '+spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql\n' +
                          '+spring.sql.init.data-locations=classpath*:db/${database}/data.sql')) {