Skip to content

Commit 25a4c27

Browse files
committed
Apply spotless
1 parent dc52b26 commit 25a4c27

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

lib-extra/src/main/java/com/diffplug/spotless/extra/middleware/ReviewDogGenerator.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
import com.diffplug.spotless.Formatter;
2929
import com.diffplug.spotless.FormatterStep;
30-
import com.diffplug.spotless.Lint;
3130
import com.diffplug.spotless.LineEnding;
31+
import com.diffplug.spotless.Lint;
3232
import com.diffplug.spotless.LintState;
3333
import com.diffplug.spotless.extra.integration.DiffMessageFormatter;
3434

@@ -49,10 +49,10 @@ public final class ReviewDogGenerator {
4949
public ReviewDogGenerator(File projectDir, List<FormatterStep> steps) {
5050
this.projectDir = projectDir;
5151
this.formatter = Formatter.builder()
52-
.encoding(StandardCharsets.UTF_8)
53-
.lineEndingsPolicy(LineEnding.UNIX.createPolicy())
54-
.steps(steps)
55-
.build();
52+
.encoding(StandardCharsets.UTF_8)
53+
.lineEndingsPolicy(LineEnding.UNIX.createPolicy())
54+
.steps(steps)
55+
.build();
5656
}
5757

5858
/**
@@ -72,7 +72,7 @@ public String generateReviewDogFormat(List<File> files) throws IOException {
7272
String relativePath = getRelativePath(file);
7373

7474
Map.Entry<Integer, String> diffResult = DiffMessageFormatter.diff(
75-
projectDir.toPath(), formatter, file);
75+
projectDir.toPath(), formatter, file);
7676

7777
List<DiffHunk> hunks = parseDiffHunks(diffResult.getValue());
7878
List<ReviewDogIssue> issues = processLints(lintState, hunks);
@@ -151,7 +151,6 @@ private List<DiffHunk> parseDiffHunks(String diffContent) {
151151
return hunks;
152152
}
153153

154-
155154
/**
156155
* Processes lint information and associates them with appropriate diff hunks.
157156
*
@@ -174,10 +173,10 @@ private List<ReviewDogIssue> processLints(LintState lintState, List<DiffHunk> hu
174173
}
175174

176175
ReviewDogIssue issue = new ReviewDogIssue(
177-
lint.getLineStart(),
178-
1,
179-
lint.getShortCode() + ": " + lint.getDetail(),
180-
suggestion);
176+
lint.getLineStart(),
177+
1,
178+
lint.getShortCode() + ": " + lint.getDetail(),
179+
suggestion);
181180

182181
issues.add(issue);
183182
}
@@ -189,10 +188,10 @@ private List<ReviewDogIssue> processLints(LintState lintState, List<DiffHunk> hu
189188
String suggestion = extractSuggestionFromHunk(firstHunk);
190189

191190
issues.add(new ReviewDogIssue(
192-
firstHunk.originalStart,
193-
1,
194-
"General formatting issue: file needs to be reformatted.",
195-
suggestion));
191+
firstHunk.originalStart,
192+
1,
193+
"General formatting issue: file needs to be reformatted.",
194+
suggestion));
196195
}
197196

198197
return issues;
@@ -208,7 +207,7 @@ private List<ReviewDogIssue> processLints(LintState lintState, List<DiffHunk> hu
208207
private DiffHunk findRelevantHunk(List<DiffHunk> hunks, int lineNumber) {
209208
for (DiffHunk hunk : hunks) {
210209
if (lineNumber >= hunk.originalStart &&
211-
lineNumber < hunk.originalStart + hunk.originalLength) {
210+
lineNumber < hunk.originalStart + hunk.originalLength) {
212211
return hunk;
213212
}
214213
}
@@ -273,7 +272,7 @@ private String formatReviewDogLine(String filePath, ReviewDogIssue issue) {
273272
StringBuilder builder = new StringBuilder();
274273

275274
builder.append(String.format("%s:%d:%d: %s\n",
276-
filePath, issue.lineNumber, issue.column, issue.message));
275+
filePath, issue.lineNumber, issue.column, issue.message));
277276

278277
if (issue.suggestion != null && !issue.suggestion.isEmpty()) {
279278
builder.append("```suggestion\n");

lib-extra/src/main/java/com/diffplug/spotless/extra/middleware/package-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
@ReturnValuesAreNonnullByDefault
33
package com.diffplug.spotless.extra.middleware;
44

5-
import com.diffplug.spotless.annotations.ReturnValuesAreNonnullByDefault;
6-
75
import javax.annotation.ParametersAreNonnullByDefault;
6+
7+
import com.diffplug.spotless.annotations.ReturnValuesAreNonnullByDefault;

lib/src/main/java/com/diffplug/spotless/LintState.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 DiffPlug
2+
* Copyright 2024-2025 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.
@@ -34,7 +34,8 @@ public class LintState {
3434
this.lintsPerStep = lintsPerStep;
3535
}
3636

37-
@Nullable public List<List<Lint>> getLintsPerStep() {
37+
@Nullable
38+
public List<List<Lint>> getLintsPerStep() {
3839
return lintsPerStep;
3940
}
4041

0 commit comments

Comments
 (0)