Skip to content

Commit 2a9e113

Browse files
author
Vincent Potucek
committed
[rewrite] fix CodeCleanup
1 parent 284bb6e commit 2a9e113

File tree

4 files changed

+30
-71
lines changed

4 files changed

+30
-71
lines changed

rewrite.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ recipeList:
77
- org.openrewrite.gradle.EnableGradleBuildCache
88
- org.openrewrite.gradle.EnableGradleParallelExecution
99
- org.openrewrite.gradle.GradleBestPractices
10+
- org.openrewrite.hcl.format.RemoveTrailingWhitespace
1011
- org.openrewrite.java.RemoveUnusedImports
12+
- org.openrewrite.java.ShortenFullyQualifiedTypeReferences
13+
- org.openrewrite.java.SimplifySingleElementAnnotation
14+
- org.openrewrite.java.format.EmptyNewlineAtEndOfFile
1115
- org.openrewrite.java.format.NormalizeFormat
1216
- org.openrewrite.java.format.NormalizeLineBreaks
17+
- org.openrewrite.java.format.PadEmptyForLoopComponents
1318
- org.openrewrite.java.format.RemoveTrailingWhitespace
1419
- org.openrewrite.java.migrate.UpgradeToJava17
20+
- org.openrewrite.java.migrate.lang.JavaLangAPIs
1521
- org.openrewrite.java.migrate.lang.StringRulesRecipes
16-
- org.openrewrite.java.migrate.util.JavaLangAPIs
1722
- org.openrewrite.java.migrate.util.JavaUtilAPIs
1823
- org.openrewrite.java.migrate.util.MigrateInflaterDeflaterToClose
1924
- org.openrewrite.java.migrate.util.ReplaceStreamCollectWithToList
@@ -22,19 +27,32 @@ recipeList:
2227
- org.openrewrite.java.recipes.RecipeTestingBestPractices
2328
- org.openrewrite.java.security.JavaSecurityBestPractices
2429
- org.openrewrite.staticanalysis.BufferedWriterCreationRecipes
30+
- org.openrewrite.staticanalysis.ChainStringBuilderAppendCalls
2531
- org.openrewrite.staticanalysis.CommonStaticAnalysis
32+
- org.openrewrite.staticanalysis.CustomImportOrder
33+
- org.openrewrite.staticanalysis.DefaultComesLast
34+
- org.openrewrite.staticanalysis.EmptyBlock
2635
- org.openrewrite.staticanalysis.EqualsAvoidsNull
36+
- org.openrewrite.staticanalysis.ExplicitInitialization
37+
- org.openrewrite.staticanalysis.FallThrough
38+
- org.openrewrite.staticanalysis.FinalizePrivateFields
39+
- org.openrewrite.staticanalysis.ForLoopControlVariablePostfixOperators
40+
- org.openrewrite.staticanalysis.HideUtilityClassConstructor
2741
- org.openrewrite.staticanalysis.JavaApiBestPractices
2842
- org.openrewrite.staticanalysis.LowercasePackage
2943
- org.openrewrite.staticanalysis.MissingOverrideAnnotation
3044
- org.openrewrite.staticanalysis.ModifierOrder
45+
- org.openrewrite.staticanalysis.NeedBraces
3146
- org.openrewrite.staticanalysis.NoFinalizer
3247
- org.openrewrite.staticanalysis.NoToStringOnStringType
3348
- org.openrewrite.staticanalysis.NoValueOfOnStringType
3449
- org.openrewrite.staticanalysis.RemoveUnusedLocalVariables
3550
- org.openrewrite.staticanalysis.RemoveUnusedPrivateFields
3651
- org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods
52+
- org.openrewrite.staticanalysis.ReplaceStringBuilderWithString
53+
- org.openrewrite.staticanalysis.ReplaceThreadRunWithThreadStart
3754
- org.openrewrite.staticanalysis.SimplifyTernaryRecipes
55+
- org.openrewrite.staticanalysis.TypecastParenPad
3856
- org.openrewrite.staticanalysis.URLEqualsHashCodeRecipes
3957
- org.openrewrite.staticanalysis.UnnecessaryCloseInTryWithResources
4058
- org.openrewrite.staticanalysis.UnnecessaryExplicitTypeArguments

testlib/src/main/java/com/diffplug/spotless/ReflectionUtil.java

Lines changed: 0 additions & 53 deletions
This file was deleted.

testlib/src/main/java/com/diffplug/spotless/TestProvisioner.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2025 DiffPlug
2+
* Copyright 2016-2026 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
1515
*/
1616
package com.diffplug.spotless;
1717

18+
import static com.diffplug.common.base.Suppliers.memoize;
19+
1820
import java.io.File;
1921
import java.io.IOException;
2022
import java.io.ObjectInputStream;
@@ -38,11 +40,15 @@
3840

3941
import com.diffplug.common.base.Errors;
4042
import com.diffplug.common.base.StandardSystemProperty;
41-
import com.diffplug.common.base.Suppliers;
4243
import com.diffplug.common.collect.ImmutableSet;
4344
import com.diffplug.common.io.Files;
4445

45-
public class TestProvisioner {
46+
public final class TestProvisioner {
47+
48+
private static final Supplier<Provisioner> MAVEN_CENTRAL = memoize(() -> caching("mavenCentral", () -> createWithRepositories(RepositoryHandler::mavenCentral)));
49+
50+
private TestProvisioner() {}
51+
4652
public static Project gradleProject(File dir) {
4753
File userHome = new File(StandardSystemProperty.USER_HOME.value());
4854
return ProjectBuilder.builder()
@@ -143,16 +149,4 @@ public static Provisioner mavenCentral() {
143149
return MAVEN_CENTRAL.get();
144150
}
145151

146-
private static final Supplier<Provisioner> MAVEN_CENTRAL = Suppliers.memoize(() -> caching("mavenCentral", () -> createWithRepositories(RepositoryHandler::mavenCentral)));
147-
148-
/** Creates a Provisioner for the local maven repo for development purpose. */
149-
public static Provisioner mavenLocal() {
150-
return createWithRepositories(RepositoryHandler::mavenLocal);
151-
}
152-
153-
/** Creates a Provisioner for the Sonatype snapshots maven repo for development purpose. */
154-
public static Provisioner snapshots() {
155-
return createWithRepositories(repo -> repo.maven(setup -> setup.setUrl("https://oss.sonatype.org/content/repositories/snapshots")));
156-
}
157-
158152
}

testlib/src/test/java/com/diffplug/spotless/PaddedCellTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2024 DiffPlug
2+
* Copyright 2016-2026 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -116,7 +116,7 @@ void diverging() throws IOException {
116116
void cycleOrder() {
117117
BiConsumer<String, String> testCase = (unorderedStr, canonical) -> {
118118
List<String> unordered = Arrays.asList(unorderedStr.split(","));
119-
for (int i = 0; i < unordered.size(); ++i) {
119+
for (int i = 0; i < unordered.size(); i++) {
120120
// try every rotation of the list
121121
Collections.rotate(unordered, 1);
122122
PaddedCell result = CYCLE.create(rootFolder, unordered);

0 commit comments

Comments
 (0)