Skip to content

Commit 3bbab43

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

4 files changed

Lines changed: 29 additions & 71 deletions

File tree

rewrite.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ recipeList:
88
- org.openrewrite.gradle.EnableGradleParallelExecution
99
- org.openrewrite.gradle.GradleBestPractices
1010
- org.openrewrite.java.RemoveUnusedImports
11+
- org.openrewrite.java.ShortenFullyQualifiedTypeReferences
12+
- org.openrewrite.java.SimplifySingleElementAnnotation
13+
- org.openrewrite.java.format.EmptyNewlineAtEndOfFile
1114
- org.openrewrite.java.format.NormalizeFormat
1215
- org.openrewrite.java.format.NormalizeLineBreaks
16+
- org.openrewrite.java.format.PadEmptyForLoopComponents
1317
- org.openrewrite.java.format.RemoveTrailingWhitespace
1418
- org.openrewrite.java.migrate.UpgradeToJava17
19+
- org.openrewrite.java.migrate.lang.JavaLangAPIs
1520
- org.openrewrite.java.migrate.lang.StringRulesRecipes
16-
- org.openrewrite.java.migrate.util.JavaLangAPIs
1721
- org.openrewrite.java.migrate.util.JavaUtilAPIs
1822
- org.openrewrite.java.migrate.util.MigrateInflaterDeflaterToClose
1923
- org.openrewrite.java.migrate.util.ReplaceStreamCollectWithToList
@@ -22,19 +26,32 @@ recipeList:
2226
- org.openrewrite.java.recipes.RecipeTestingBestPractices
2327
- org.openrewrite.java.security.JavaSecurityBestPractices
2428
- org.openrewrite.staticanalysis.BufferedWriterCreationRecipes
29+
- org.openrewrite.staticanalysis.ChainStringBuilderAppendCalls
2530
- org.openrewrite.staticanalysis.CommonStaticAnalysis
31+
- org.openrewrite.staticanalysis.CustomImportOrder
32+
- org.openrewrite.staticanalysis.DefaultComesLast
33+
- org.openrewrite.staticanalysis.EmptyBlock
2634
- org.openrewrite.staticanalysis.EqualsAvoidsNull
35+
- org.openrewrite.staticanalysis.ExplicitInitialization
36+
- org.openrewrite.staticanalysis.FallThrough
37+
- org.openrewrite.staticanalysis.FinalizePrivateFields
38+
- org.openrewrite.staticanalysis.ForLoopControlVariablePostfixOperators
39+
- org.openrewrite.staticanalysis.HideUtilityClassConstructor
2740
- org.openrewrite.staticanalysis.JavaApiBestPractices
2841
- org.openrewrite.staticanalysis.LowercasePackage
2942
- org.openrewrite.staticanalysis.MissingOverrideAnnotation
3043
- org.openrewrite.staticanalysis.ModifierOrder
44+
- org.openrewrite.staticanalysis.NeedBraces
3145
- org.openrewrite.staticanalysis.NoFinalizer
3246
- org.openrewrite.staticanalysis.NoToStringOnStringType
3347
- org.openrewrite.staticanalysis.NoValueOfOnStringType
3448
- org.openrewrite.staticanalysis.RemoveUnusedLocalVariables
3549
- org.openrewrite.staticanalysis.RemoveUnusedPrivateFields
3650
- org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods
51+
- org.openrewrite.staticanalysis.ReplaceStringBuilderWithString
52+
- org.openrewrite.staticanalysis.ReplaceThreadRunWithThreadStart
3753
- org.openrewrite.staticanalysis.SimplifyTernaryRecipes
54+
- org.openrewrite.staticanalysis.TypecastParenPad
3855
- org.openrewrite.staticanalysis.URLEqualsHashCodeRecipes
3956
- org.openrewrite.staticanalysis.UnnecessaryCloseInTryWithResources
4057
- 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)