Skip to content

Commit 0bfd109

Browse files
committed
add spotless
1 parent b1b9e48 commit 0bfd109

File tree

54 files changed

+267
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+267
-253
lines changed

.github/workflows/_static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
cache: "maven"
2121

2222
- name: Check Code Style
23-
run: mvn --update-snapshots --no-transfer-progress checkstyle:check
23+
run: mvn --update-snapshots --no-transfer-progress process-sources

pom.xml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<dependency>
103103
<groupId>com.puppycrawl.tools</groupId>
104104
<artifactId>checkstyle</artifactId>
105-
<version>10.9.3</version>
105+
<version>10.12.7</version>
106106
</dependency>
107107
</dependencies>
108108
<configuration>
@@ -113,7 +113,24 @@
113113
</configuration>
114114
<executions>
115115
<execution>
116-
<id>validate</id>
116+
<phase>process-sources</phase>
117+
<goals>
118+
<goal>check</goal>
119+
</goals>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
<plugin>
124+
<groupId>com.diffplug.spotless</groupId>
125+
<artifactId>spotless-maven-plugin</artifactId>
126+
<version>2.30.0</version>
127+
<configuration>
128+
<java>
129+
<importOrder/>
130+
</java>
131+
</configuration>
132+
<executions>
133+
<execution>
117134
<phase>validate</phase>
118135
<goals>
119136
<goal>check</goal>
@@ -123,6 +140,7 @@
123140
</plugin>
124141
</plugins>
125142
</pluginManagement>
143+
126144
<plugins>
127145
<plugin>
128146
<groupId>org.apache.maven.plugins</groupId>
@@ -132,6 +150,10 @@
132150
<target>8</target>
133151
</configuration>
134152
</plugin>
153+
<plugin>
154+
<groupId>com.diffplug.spotless</groupId>
155+
<artifactId>spotless-maven-plugin</artifactId>
156+
</plugin>
135157
<plugin>
136158
<groupId>org.apache.maven.plugins</groupId>
137159
<artifactId>maven-checkstyle-plugin</artifactId>

src/test/java/com/mindee/MindeeClientTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
package com.mindee;
22

3+
import static com.mindee.TestingUtilities.assertStringEqualsFile;
4+
import static com.mindee.TestingUtilities.getResourcePath;
5+
import static com.mindee.TestingUtilities.getV1ResourcePathString;
6+
37
import com.mindee.http.Endpoint;
4-
import com.mindee.input.LocalResponse;
5-
import com.mindee.input.LocalInputSource;
68
import com.mindee.http.MindeeApi;
79
import com.mindee.http.RequestParameters;
10+
import com.mindee.input.LocalInputSource;
11+
import com.mindee.input.LocalResponse;
812
import com.mindee.input.PageOptions;
913
import com.mindee.input.PageOptionsOperation;
1014
import com.mindee.parsing.common.AsyncPredictResponse;
1115
import com.mindee.parsing.common.Document;
1216
import com.mindee.parsing.common.Job;
1317
import com.mindee.parsing.common.PredictResponse;
14-
import static com.mindee.TestingUtilities.assertStringEqualsFile;
18+
import com.mindee.pdf.PdfOperation;
19+
import com.mindee.pdf.SplitPdf;
1520
import com.mindee.product.custom.CustomV1;
1621
import com.mindee.product.generated.GeneratedV1;
17-
import com.mindee.product.invoice.InvoiceV4;
1822
import com.mindee.product.internationalid.InternationalIdV2;
19-
import com.mindee.pdf.PdfOperation;
20-
import com.mindee.pdf.SplitPdf;
23+
import com.mindee.product.invoice.InvoiceV4;
2124
import java.io.File;
2225
import java.io.IOException;
2326
import java.net.URL;
@@ -33,9 +36,6 @@
3336
import org.mockito.Mockito;
3437
import org.mockito.junit.jupiter.MockitoExtension;
3538

36-
import static com.mindee.TestingUtilities.getResourcePath;
37-
import static com.mindee.TestingUtilities.getV1ResourcePathString;
38-
3939
@ExtendWith(MockitoExtension.class)
4040
class MindeeClientTest {
4141

src/test/java/com/mindee/MindeeClientV2Test.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
package com.mindee;
22

3+
import static com.mindee.TestingUtilities.getResourcePath;
4+
import static org.junit.jupiter.api.Assertions.*;
5+
import static org.mockito.ArgumentMatchers.*;
6+
import static org.mockito.Mockito.*;
7+
38
import com.fasterxml.jackson.core.JsonProcessingException;
49
import com.fasterxml.jackson.databind.ObjectMapper;
510
import com.mindee.http.MindeeApiV2;
@@ -14,11 +19,6 @@
1419
import org.junit.jupiter.api.Test;
1520
import org.mockito.Mockito;
1621

17-
import static com.mindee.TestingUtilities.getResourcePath;
18-
import static org.junit.jupiter.api.Assertions.*;
19-
import static org.mockito.ArgumentMatchers.*;
20-
import static org.mockito.Mockito.*;
21-
2222
@DisplayName("MindeeV2 – Client and API Tests")
2323
class MindeeClientV2Test {
2424
/**

src/test/java/com/mindee/TestingUtilities.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
package com.mindee;
22

3-
import org.junit.jupiter.api.Assertions;
4-
53
import java.io.IOException;
64
import java.nio.file.Files;
75
import java.nio.file.Path;
86
import java.nio.file.Paths;
97
import java.util.List;
108
import java.util.Objects;
9+
import org.junit.jupiter.api.Assertions;
1110

1211
public class TestingUtilities {
1312
public static Path getResourcePath(String filePath) {
@@ -156,4 +155,3 @@ public static double levenshteinRatio(String referenceString, String targetStrin
156155
}
157156

158157
}
159-

src/test/java/com/mindee/extraction/ImageExtractorTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
package com.mindee.extraction;
22

3+
import static com.mindee.TestingUtilities.getResourcePath;
4+
import static com.mindee.TestingUtilities.getV1ResourcePath;
5+
import static com.mindee.TestingUtilities.getV1ResourcePathString;
6+
37
import com.fasterxml.jackson.databind.JavaType;
48
import com.fasterxml.jackson.databind.ObjectMapper;
59
import com.mindee.input.LocalInputSource;
@@ -9,14 +13,10 @@
913
import com.mindee.product.barcodereader.BarcodeReaderV1Document;
1014
import com.mindee.product.multireceiptsdetector.MultiReceiptsDetectorV1;
1115
import com.mindee.product.multireceiptsdetector.MultiReceiptsDetectorV1Document;
12-
import org.junit.jupiter.api.Assertions;
13-
import org.junit.jupiter.api.Test;
1416
import java.io.IOException;
1517
import java.util.List;
16-
17-
import static com.mindee.TestingUtilities.getResourcePath;
18-
import static com.mindee.TestingUtilities.getV1ResourcePath;
19-
import static com.mindee.TestingUtilities.getV1ResourcePathString;
18+
import org.junit.jupiter.api.Assertions;
19+
import org.junit.jupiter.api.Test;
2020

2121

2222
public class ImageExtractorTest {

src/test/java/com/mindee/extraction/PDFExtractorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.mindee.extraction;
22

3+
import static com.mindee.TestingUtilities.getV1ResourcePath;
4+
35
import com.fasterxml.jackson.databind.JavaType;
46
import com.fasterxml.jackson.databind.ObjectMapper;
57
import com.mindee.input.LocalInputSource;
@@ -10,8 +12,6 @@
1012
import org.junit.jupiter.api.Assertions;
1113
import org.junit.jupiter.api.Test;
1214

13-
import static com.mindee.TestingUtilities.getV1ResourcePath;
14-
1515
public class PDFExtractorTest {
1616

1717
protected PredictResponse<InvoiceSplitterV1> getInvoiceSplitterPrediction() throws

src/test/java/com/mindee/input/FileCompressionTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
package com.mindee.input;
22

3+
import static com.mindee.TestingUtilities.getResourcePath;
4+
import static com.mindee.TestingUtilities.getV1ResourcePath;
5+
36
import com.mindee.image.ImageCompressor;
47
import com.mindee.pdf.PdfCompressor;
5-
import org.apache.pdfbox.Loader;
6-
import org.apache.pdfbox.pdmodel.PDDocument;
7-
import org.apache.pdfbox.text.PDFTextStripper;
8-
import org.junit.jupiter.api.Assertions;
9-
import org.junit.jupiter.api.Test;
10-
11-
import javax.imageio.ImageIO;
128
import java.awt.image.BufferedImage;
139
import java.io.IOException;
1410
import java.nio.file.Files;
1511
import java.nio.file.Path;
1612
import java.util.Arrays;
1713
import java.util.List;
1814
import java.util.stream.Collectors;
19-
20-
import static com.mindee.TestingUtilities.getResourcePath;
21-
import static com.mindee.TestingUtilities.getV1ResourcePath;
15+
import javax.imageio.ImageIO;
16+
import org.apache.pdfbox.Loader;
17+
import org.apache.pdfbox.pdmodel.PDDocument;
18+
import org.apache.pdfbox.text.PDFTextStripper;
19+
import org.junit.jupiter.api.Assertions;
20+
import org.junit.jupiter.api.Test;
2221

2322
public class FileCompressionTest {
2423

src/test/java/com/mindee/input/LocalInputSourceTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
package com.mindee.input;
22

3+
import static com.mindee.TestingUtilities.getResourcePath;
4+
import static com.mindee.TestingUtilities.getV1ResourcePath;
5+
36
import com.mindee.MindeeException;
47
import java.io.File;
58
import java.io.IOException;
69
import java.nio.file.Files;
710
import java.nio.file.Path;
8-
911
import org.apache.commons.codec.binary.Base64;
1012
import org.junit.jupiter.api.Assertions;
1113
import org.junit.jupiter.api.Test;
1214

13-
import static com.mindee.TestingUtilities.getResourcePath;
14-
import static com.mindee.TestingUtilities.getV1ResourcePath;
15-
1615
public class LocalInputSourceTest {
1716
void assertMultipagePDF(LocalInputSource inputSource, Path filePath) throws IOException {
1817
Assertions.assertNotNull(inputSource);

src/test/java/com/mindee/input/LocalResponseV1Test.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.mindee.input;
22

3-
import org.junit.jupiter.api.Assertions;
4-
import org.junit.jupiter.api.Test;
3+
import static com.mindee.TestingUtilities.getV1ResourcePath;
4+
55
import java.io.File;
66
import java.io.IOException;
77
import java.nio.file.Files;
88
import java.nio.file.Path;
9-
10-
import static com.mindee.TestingUtilities.getV1ResourcePath;
9+
import org.junit.jupiter.api.Assertions;
10+
import org.junit.jupiter.api.Test;
1111

1212

1313
public class LocalResponseV1Test {

0 commit comments

Comments
 (0)