Skip to content

Conversation

Pankraz76
Copy link

What's changed?

What's your motivation?

Anything in particular you'd like reviewers to focus on?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

@@ -75,7 +75,7 @@ final class EncodingErrorMsg {
 
                int line = 1;
                int col = 1;
-               for (int i = 0; i < unrepresentable; i++) {
+               for (int i = 0;i < unrepresentable;i++) {
                        char c = chars.charAt(i);
                        if (c == '\n') {
                                ++line;
diff --git a/lib/src/main/java/com/diffplug/spotless/FileSignature.java b/lib/src/main/java/com/diffplug/spotless/FileSignature.java
index f0332aef1..30254bdac 100644
--- a/lib/src/main/java/com/diffplug/spotless/FileSignature.java
+++ b/lib/src/main/java/com/diffplug/spotless/FileSignature.java
@@ -186,7 +186,7 @@ public final class FileSignature implements Serializable {
 
                synchronized Sig sign(File fileInput) throws IOException {
                        String canonicalPath = fileInput.getCanonicalPath();
-                       Sig sig = cache.computeIfAbsent(canonicalPath, ThrowingEx.<String, Sig> wrap(p -> {
+                       Sig sig = cache.computeIfAbsent(canonicalPath, ThrowingEx.<String, Sig>wrap(p -> {
                                MessageDigest digest = MessageDigest.getInstance("SHA-256");
                                File file = new File(p);
                                // calculate the size and content hash of the file
diff --git a/lib/src/main/java/com/diffplug/spotless/Formatter.java b/lib/src/main/java/com/diffplug/spotless/Formatter.java
index 941667adb..a0cfa263b 100644
--- a/lib/src/main/java/com/diffplug/spotless/Formatter.java
+++ b/lib/src/main/java/com/diffplug/spotless/Formatter.java
@@ -140,7 +140,7 @@ public final class Formatter implements Serializable, AutoCloseable {
        }
 
        static void legacyErrorBehavior(Formatter formatter, File file, ValuePerStep<Throwable> exceptionPerStep) {
-               for (int i = 0; i < formatter.getSteps().size(); i++) {
+               for (int i = 0;i < formatter.getSteps().size();i++) {

}

@Test
void forLoopWithCorrectSpacing() {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not reproduceable yet.

@timtebeek timtebeek marked this pull request as draft September 29, 2025 08:56
@timtebeek
Copy link
Member

Usually when there's formatting only changes the problem is with inconsistently formatting in the input project leading to suboptimal detection of the style, rather than with the specific recipe. Might that be the case here as well? If so we can close this PR, as it's not an issue with this recipe.

@timtebeek timtebeek added the question Further information is requested label Sep 29, 2025
@Pankraz76
Copy link
Author

yes the recipe might not be the issue but considering the log and diff. The code is fine is the source file before visit, after its broken biting the whitespaces.

Changes have been made to lib/src/main/java/com/diffplug/spotless/FileSignature.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.MethodParamPad
Changes have been made to lib/src/main/java/com/diffplug/spotless/Lint.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.NoWhitespaceBefore
Changes have been made to lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.MethodParamPad
Changes have been made to lib/src/main/java/com/diffplug/spotless/java/FormatAnnotationsStep.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.NoWhitespaceBefore
Changes have been made to lib/src/main/java/com/diffplug/spotless/java/ImportSorterImpl.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.NoWhitespaceBefore
Changes have been made to lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.MethodParamPad
Changes have been made to lib/src/main/java/com/diffplug/spotless/java/CleanthatJavaStep.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.MethodParamPad
Changes have been made to lib/src/main/java/com/diffplug/spotless/LintState.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.NoWhitespaceBefore
Changes have been made to lib/src/main/java/com/diffplug/spotless/ValuePerStep.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.NoWhitespaceBefore
Changes have been made to lib/src/main/java/com/diffplug/spotless/Formatter.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.NoWhitespaceBefore
Changes have been made to lib/src/main/java/com/diffplug/spotless/EncodingErrorMsg.java by:
    com.diffplug.spotless.openrewrite.SanityCheck
        org.openrewrite.staticanalysis.CodeCleanup
            org.openrewrite.java.format.NoWhitespaceBefore
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants