Skip to content

Commit 20f22d6

Browse files
committed
spotbugs
1 parent 2726985 commit 20f22d6

File tree

14 files changed

+271
-41
lines changed

14 files changed

+271
-41
lines changed

common/pom.xml

+18
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,22 @@
6565
</dependency>
6666
</dependencies>
6767

68+
<build>
69+
<plugins>
70+
<plugin>
71+
<groupId>com.github.spotbugs</groupId>
72+
<artifactId>spotbugs-maven-plugin</artifactId>
73+
<configuration>
74+
<excludeFilterFile>../spot-bugs.filter-exclude.xml</excludeFilterFile>
75+
</configuration>
76+
</plugin>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-checkstyle-plugin</artifactId>
80+
<configuration>
81+
<configLocation>../checkstyle.xml</configLocation>
82+
</configuration>
83+
</plugin>
84+
</plugins>
85+
</build>
6886
</project>

content-checker/content-checker-service-model/pom.xml

+11
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@
2727

2828
</dependencies>
2929

30+
<build>
31+
<plugins>
32+
<plugin>
33+
<groupId>com.github.spotbugs</groupId>
34+
<artifactId>spotbugs-maven-plugin</artifactId>
35+
<configuration>
36+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
37+
</configuration>
38+
</plugin>
39+
</plugins>
40+
</build>
3041
</project>

content-checker/content-checker-service/pom.xml

+14
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@
5757
<groupId>org.springframework.boot</groupId>
5858
<artifactId>spring-boot-maven-plugin</artifactId>
5959
</plugin>
60+
<plugin>
61+
<groupId>com.github.spotbugs</groupId>
62+
<artifactId>spotbugs-maven-plugin</artifactId>
63+
<configuration>
64+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
65+
</configuration>
66+
</plugin>
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-checkstyle-plugin</artifactId>
70+
<configuration>
71+
<configLocation>../../checkstyle.xml</configLocation>
72+
</configuration>
73+
</plugin>
6074
</plugins>
6175
</build>
6276

email/email-service-api/pom.xml

+18
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,22 @@
3333
</dependency>
3434
</dependencies>
3535

36+
<build>
37+
<plugins>
38+
<plugin>
39+
<groupId>com.github.spotbugs</groupId>
40+
<artifactId>spotbugs-maven-plugin</artifactId>
41+
<configuration>
42+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
43+
</configuration>
44+
</plugin>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-checkstyle-plugin</artifactId>
48+
<configuration>
49+
<configLocation>../checkstyle.xml</configLocation>
50+
</configuration>
51+
</plugin>
52+
</plugins>
53+
</build>
3654
</project>

email/pom.xml

+19
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,24 @@
1919
<module>email-service-api</module>
2020
</modules>
2121

22+
<build>
23+
<plugins>
24+
<plugin>
25+
<groupId>com.github.spotbugs</groupId>
26+
<artifactId>spotbugs-maven-plugin</artifactId>
27+
<configuration>
28+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
29+
</configuration>
30+
</plugin>
31+
<plugin>
32+
<groupId>org.apache.maven.plugins</groupId>
33+
<artifactId>maven-checkstyle-plugin</artifactId>
34+
<configuration>
35+
<configLocation>../../checkstyle.xml</configLocation>
36+
</configuration>
37+
</plugin>
38+
</plugins>
39+
</build>
40+
2241

2342
</project>

main-app/main-orm/pom.xml

+14
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,20 @@
146146
</dependency>
147147
</dependencies>
148148
</plugin>
149+
<plugin>
150+
<groupId>com.github.spotbugs</groupId>
151+
<artifactId>spotbugs-maven-plugin</artifactId>
152+
<configuration>
153+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
154+
</configuration>
155+
</plugin>
156+
<plugin>
157+
<groupId>org.apache.maven.plugins</groupId>
158+
<artifactId>maven-checkstyle-plugin</artifactId>
159+
<configuration>
160+
<configLocation>../../checkstyle.xml</configLocation>
161+
</configuration>
162+
</plugin>
149163
</plugins>
150164
</build>
151165

main-app/main-webapp/pom.xml

+20-21
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,18 @@
249249
</dependency>
250250

251251
<!--spring cloud contract stubs -->
252-
<!-- <dependency>-->
253-
<!-- <groupId>gt.app</groupId>-->
254-
<!-- <artifactId>email-service</artifactId>-->
255-
<!-- <classifier>stub</classifier>-->
256-
<!-- <version>${project.parent.version}</version>-->
257-
<!-- <exclusions>-->
258-
<!-- <exclusion>-->
259-
<!-- <groupId>*</groupId>-->
260-
<!-- <artifactId>*</artifactId>-->
261-
<!-- </exclusion>-->
262-
<!-- </exclusions>-->
263-
<!-- </dependency>-->
252+
<!-- <dependency>-->
253+
<!-- <groupId>gt.app</groupId>-->
254+
<!-- <artifactId>email-service</artifactId>-->
255+
<!-- <classifier>stub</classifier>-->
256+
<!-- <version>${project.parent.version}</version>-->
257+
<!-- <exclusions>-->
258+
<!-- <exclusion>-->
259+
<!-- <groupId>*</groupId>-->
260+
<!-- <artifactId>*</artifactId>-->
261+
<!-- </exclusion>-->
262+
<!-- </exclusions>-->
263+
<!-- </dependency>-->
264264
<!-- test only dependencies -->
265265
</dependencies>
266266

@@ -339,20 +339,19 @@
339339
</executions>
340340
</plugin>
341341

342+
<plugin>
343+
<groupId>com.github.spotbugs</groupId>
344+
<artifactId>spotbugs-maven-plugin</artifactId>
345+
<configuration>
346+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
347+
</configuration>
348+
</plugin>
342349
<plugin>
343350
<groupId>org.apache.maven.plugins</groupId>
344351
<artifactId>maven-checkstyle-plugin</artifactId>
345-
<version>${maven.checkstyle.plugin.version}</version>
346352
<configuration>
347-
<configLocation>src/main/resources/checkstyle.xml</configLocation>
353+
<configLocation>../../checkstyle.xml</configLocation>
348354
</configuration>
349-
<dependencies>
350-
<dependency>
351-
<groupId>com.puppycrawl.tools</groupId>
352-
<artifactId>checkstyle</artifactId>
353-
<version>${puppycrawl.checkstyle.version}</version>
354-
</dependency>
355-
</dependencies>
356355
</plugin>
357356

358357
<plugin>

main-app/main-webapp/src/main/java/gt/app/modules/user/UserService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void updateUserIfNeeded(User user) {
3232
}
3333

3434
public User getReference(UUID id) {
35-
return userRepository.getById(id);
35+
return userRepository.getReferenceById(id);
3636
}
3737

3838
public Optional<User> find(UUID id) {

main-app/report-service/pom.xml

+14
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@
4848
<groupId>org.springframework.boot</groupId>
4949
<artifactId>spring-boot-maven-plugin</artifactId>
5050
</plugin>
51+
<plugin>
52+
<groupId>com.github.spotbugs</groupId>
53+
<artifactId>spotbugs-maven-plugin</artifactId>
54+
<configuration>
55+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-checkstyle-plugin</artifactId>
61+
<configuration>
62+
<configLocation>../../checkstyle.xml</configLocation>
63+
</configuration>
64+
</plugin>
5165
</plugins>
5266
</build>
5367

pom.xml

+86-19
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
<gmavenplus.version>1.13.1</gmavenplus.version>
6161
<maven-processor-plugin.version>4.2</maven-processor-plugin.version>
6262
<modernizer-maven-plugin.version>2.3.0</modernizer-maven-plugin.version>
63+
<puppycrawl.checkstyle.config.file>src/main/resources/checkstyle.xml</puppycrawl.checkstyle.config.file>
64+
<google.error-prone.compiler.version>2.14.0</google.error-prone.compiler.version>
65+
6366
</properties>
6467

6568

@@ -202,25 +205,89 @@
202205
</dependencyManagement>
203206

204207
<build>
205-
<plugins>
206-
<plugin>
207-
<groupId>org.gaul</groupId>
208-
<artifactId>modernizer-maven-plugin</artifactId>
209-
<version>${modernizer-maven-plugin.version}</version>
210-
<executions>
211-
<execution>
212-
<id>modernizer</id>
213-
<phase>package</phase>
214-
<goals>
215-
<goal>modernizer</goal>
216-
</goals>
217-
</execution>
218-
</executions>
219-
<configuration>
220-
<javaVersion>${java.version}</javaVersion>
221-
</configuration>
222-
</plugin>
223-
</plugins>
208+
<pluginManagement>
209+
<plugins>
210+
<plugin>
211+
<groupId>org.gaul</groupId>
212+
<artifactId>modernizer-maven-plugin</artifactId>
213+
<version>${modernizer-maven-plugin.version}</version>
214+
<executions>
215+
<execution>
216+
<id>modernizer</id>
217+
<phase>package</phase>
218+
<goals>
219+
<goal>modernizer</goal>
220+
</goals>
221+
</execution>
222+
</executions>
223+
<configuration>
224+
<javaVersion>${java.version}</javaVersion>
225+
</configuration>
226+
</plugin>
227+
228+
<plugin>
229+
<groupId>org.apache.maven.plugins</groupId>
230+
<artifactId>maven-checkstyle-plugin</artifactId>
231+
<version>${maven.checkstyle.plugin.version}</version>
232+
<configuration>
233+
<configLocation>${puppycrawl.checkstyle.config.file}</configLocation>
234+
</configuration>
235+
<dependencies>
236+
<dependency>
237+
<groupId>com.puppycrawl.tools</groupId>
238+
<artifactId>checkstyle</artifactId>
239+
<version>${puppycrawl.checkstyle.version}</version>
240+
</dependency>
241+
</dependencies>
242+
<executions>
243+
<execution>
244+
<id>verify-checkstyle</id>
245+
<phase>test-compile</phase>
246+
<goals>
247+
<goal>check</goal>
248+
</goals>
249+
</execution>
250+
</executions>
251+
</plugin>
252+
253+
<plugin>
254+
<groupId>org.gaul</groupId>
255+
<artifactId>modernizer-maven-plugin</artifactId>
256+
<version>${modernizer-maven-plugin.version}</version>
257+
<executions>
258+
<execution>
259+
<id>modernizer</id>
260+
<phase>test-compile</phase>
261+
<goals>
262+
<goal>modernizer</goal>
263+
</goals>
264+
</execution>
265+
</executions>
266+
<configuration>
267+
<javaVersion>${java.version}</javaVersion>
268+
<includeTestClasses>false</includeTestClasses>
269+
</configuration>
270+
</plugin>
271+
272+
<plugin>
273+
<groupId>com.github.spotbugs</groupId>
274+
<artifactId>spotbugs-maven-plugin</artifactId>
275+
<executions>
276+
<execution>
277+
<id>verify-spotbugs</id>
278+
<phase>test-compile</phase>
279+
<goals>
280+
<goal>check</goal>
281+
</goals>
282+
</execution>
283+
</executions>
284+
<configuration>
285+
<excludeFilterFile>spot-bugs.filter-exclude.xml</excludeFilterFile>
286+
<includeTests>false</includeTests>
287+
</configuration>
288+
</plugin>
289+
</plugins>
290+
</pluginManagement>
224291
</build>
225292

226293
<!-- <repositories>-->

spot-bugs.filter-exclude.xml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<FindBugsFilter>
4+
<And>
5+
<Bug category="MALICIOUS_CODE"/>
6+
<Bug pattern="EI_EXPOSE_REP"/>
7+
</And>
8+
<And>
9+
<Bug category="BAD_PRACTICE"/>
10+
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
11+
</And>
12+
<And>
13+
<Bug category="MALICIOUS_CODE"/>
14+
<Bug pattern="EI_EXPOSE_REP2"/>
15+
</And>
16+
<And>
17+
<Bug category="BAD_PRACTICE"/>
18+
<Bug pattern="SE_BAD_FIELD"/>
19+
</And>
20+
<Match>
21+
<Source name="~generated-sources\..*"/>
22+
</Match>
23+
</FindBugsFilter>

trend/trend-service-api/pom.xml

+18
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,22 @@
3333
</dependency>
3434
</dependencies>
3535

36+
<build>
37+
<plugins>
38+
<plugin>
39+
<groupId>com.github.spotbugs</groupId>
40+
<artifactId>spotbugs-maven-plugin</artifactId>
41+
<configuration>
42+
<excludeFilterFile>../../spot-bugs.filter-exclude.xml</excludeFilterFile>
43+
</configuration>
44+
</plugin>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-checkstyle-plugin</artifactId>
48+
<configuration>
49+
<configLocation>../../checkstyle.xml</configLocation>
50+
</configuration>
51+
</plugin>
52+
</plugins>
53+
</build>
3654
</project>

0 commit comments

Comments
 (0)