2727
2828import com .diffplug .spotless .Formatter ;
2929import com .diffplug .spotless .FormatterStep ;
30- import com .diffplug .spotless .Lint ;
3130import com .diffplug .spotless .LineEnding ;
31+ import com .diffplug .spotless .Lint ;
3232import com .diffplug .spotless .LintState ;
3333import 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 " );
0 commit comments