Skip to content

Commit 8693dcd

Browse files
authored
Update spotbugs excludes filter (#189)
* Latest google_checks * Updates to google_checks 8.36.1 from 8.30 * App should pass - fix test/App.java * test/ should use Java 11 * add skipTests property - override w/ -DskipTests=true Fixes #134 * Update spotBugsExcludeFilter.xml Update the excludeList based on fixes #136 & #171
1 parent b1f9679 commit 8693dcd

File tree

6 files changed

+384
-324
lines changed

6 files changed

+384
-324
lines changed

checkstyle-config/src/main/resources/c.g.c.s/spotBugsExcludeFilter.xml

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,28 @@ see https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html
2525
xmlns="https://github.com/spotbugs/filter/3.0.0"
2626
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2727
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
28+
<!-- <Bug pattern="DLS_DEAD_LOCAL_STORE" />-->
29+
30+
<Match> <!-- Global excludes https://github.com/GoogleCloudPlatform/java-repo-tools/issues/136 -->
31+
<Or>
32+
<Bug pattern="IMC_IMMATURE_CLASS_NO_TOSTRING" /> <!-- Let me skip toString() -->
33+
<Bug pattern="CRLF_INJECTION_LOGS" /> <!-- Let me inject /n/r into logs -->
34+
</Or>
35+
</Match>
36+
2837
<Match>
29-
<!-- TODO: Remove once SpotBugs fully supports Java 11 (JENKINS-53720) -->
30-
<!-- JDK 11 generates a different binary code than expected by SpotBugs -->
31-
<!-- https://github.com/spotbugs/spotbugs/issues/756 -->
32-
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
38+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/171 -->
39+
<!-- query watch where a callback has to be supplied (sure it could be a separate class from a
40+
type signature standpoint, but that moves the code away from the sample) -->
41+
<Bug pattern="SIC_INNER_SHOULD_BE_STATIC_ANON" />
3342
</Match>
34-
<!-- From https://github.com/GoogleCloudPlatform/java-repo-tools/issues/123 -->
35-
<!-- https://github.com/GoogleCloudPlatform/java-docs-samples/pull/2630#issuecomment-612320968 -->
36-
<!-- <Bug pattern="IMC_IMMATURE_CLASS_NO_TOSTRING" />-->
37-
<!-- <Bug pattern="CRLF_INJECTION_LOGS" />-->
38-
<!-- <Bug pattern="LI_LAZY_INIT_STATIC" />-->
39-
<!-- <Bug pattern="DLS_DEAD_LOCAL_STORE" />-->
4043

44+
<Match>
45+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/171 -->
46+
<!-- code in question is creating the initial dataset to show how queries work, and
47+
necessarily have to call the same methods a few times -->
48+
<Bug pattern="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" />
49+
</Match>
4150
<Match>
4251
<!-- https://github.com/spotbugs/spotbugs/issues/735 -->
4352
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
@@ -48,15 +57,36 @@ see https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html
4857
</Match>
4958

5059
<Match>
51-
<!-- Samples uses this idiom a lot, so I'm turning it off -->
60+
<!-- Samples uses this idiom a lot -->
5261
<Bug pattern="CLI_CONSTANT_LIST_INDEX"/>
5362
</Match>
54-
<Match>
55-
<!-- https://github.com/spotbugs/spotbugs/issues/925 -->
56-
<Bug pattern="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS"/>
57-
</Match>
63+
5864
<Match>
5965
<!-- https://github.com/spotbugs/spotbugs/issues/293 -->
6066
<Bug pattern="OBL_UNSATISFIED_OBLIGATION"/>
6167
</Match>
68+
<Match>
69+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/136 -->
70+
<Bug pattern="SE_NO_SERIALVERSIONID" />
71+
</Match>
72+
<Match>
73+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/136 -->
74+
<Bug pattern="SERVLET_PARAMETER" />
75+
</Match>
76+
<Match>
77+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/136 -->
78+
<Bug pattern="WEM_WEAK_EXCEPTION_MESSAGING" />
79+
</Match>
80+
<Match>
81+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/136 -->
82+
<Bug pattern="ODR_OPEN_DATABASE_RESOURCE" />
83+
</Match>
84+
<Match>
85+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/136 -->
86+
<Bug pattern="XSS_SERVLET" />
87+
</Match>
88+
<Match>
89+
<!-- https://github.com/GoogleCloudPlatform/java-repo-tools/issues/136 -->
90+
<Bug pattern="HARD_CODE_PASSWORD" />
91+
</Match>
6292
</FindBugsFilter>

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ limitations under the License.
2929
<versions-maven-plugin>2.7</versions-maven-plugin>
3030
<maven-gpg-plugin>1.6</maven-gpg-plugin>
3131
<pmdVersion>6.27.0</pmdVersion>
32+
<skipTests>false</skipTests>
3233
</properties>
3334

3435
<groupId>com.google.cloud.samples</groupId>
@@ -344,6 +345,7 @@ limitations under the License.
344345
<artifactId>maven-surefire-plugin</artifactId>
345346
<version>3.0.0-M5</version>
346347
<configuration>
348+
<skipTests>${skipTests}</skipTests>
347349
<reportNameSuffix>sponge_log</reportNameSuffix>
348350
<trimStackTrace>false</trimStackTrace>
349351
</configuration>

test/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ limitations under the License.
3131
</parent>
3232

3333
<properties>
34-
<maven.compiler.source>1.8</maven.compiler.source> <!-- REQUIRED -->
35-
<maven.compiler.target>1.8</maven.compiler.target> <!-- REQUIRED -->
34+
<maven.compiler.source>11</maven.compiler.source> <!-- REQUIRED -->
35+
<maven.compiler.target>11</maven.compiler.target> <!-- REQUIRED -->
3636
</properties>
3737

3838
<dependencies>

test/src/main/java/com/google/cloud/samples/test/App.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616

1717
package com.google.cloud.samples.test;
1818

19+
import java.time.LocalDateTime;
20+
1921
/** A hello world app to test the parent pom.xml. */
2022
public class App {
2123
public static void main(String[] args) {
2224
App app = new App();
2325
System.out.println(app.greeting());
2426
}
2527

26-
public String greeting() {
27-
return "Hello World!";
28+
private String greeting() {
29+
return "Hello World! " + LocalDateTime.now();
2830
}
2931
}

third_party/checkstyle/METADATA

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ third_party {
1313
type: GIT
1414
value: "https://github.com/checkstyle/checkstyle"
1515
}
16-
version: "8.30"
17-
last_upgrade_date { year: 2020 month: 3 day: 5 }
16+
version: "8.36.1"
17+
last_upgrade_date { year: 2020 month: 9 day: 22 }
1818
local_modifications: "RegexpHeader, severity, SupressWaringsHolder, and SuppressionCommentFilter"
1919
}

0 commit comments

Comments
 (0)