Skip to content

Commit cc061ee

Browse files
committed
Build: Updated configs
Updated checkstyle, spock and spotbugs versions JAVA-4357
1 parent 1fe0761 commit cc061ee

File tree

5 files changed

+51
-29
lines changed

5 files changed

+51
-29
lines changed

build.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ buildscript {
2525
}
2626
dependencies {
2727
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3'
28-
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.5.0"
28+
classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.9"
2929
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:5.1.2'
3030

3131
// Scala plugins
@@ -151,7 +151,7 @@ configure(scalaProjects) {
151151

152152
spotless {
153153
scala {
154-
scalafmt('2.0.0').configFile("$configDir/scalafmt.conf")
154+
scalafmt('2.0.0').configFile("$configDir/scala/scalafmt.conf")
155155
}
156156
}
157157
compileScala.dependsOn('spotlessApply')
@@ -253,7 +253,7 @@ configure(javaCodeCheckedProjects) {
253253
testImplementation('org.junit.jupiter:junit-jupiter-params')
254254
testImplementation('org.junit.vintage:junit-vintage-engine')
255255

256-
testImplementation platform('org.spockframework:spock-bom:2.0-groovy-2.5')
256+
testImplementation platform('org.spockframework:spock-bom:2.0-groovy-3.0')
257257
testImplementation 'org.spockframework:spock-core'
258258
testImplementation 'org.spockframework:spock-junit4'
259259
testImplementation("org.mockito:mockito-core:3.8.0")
@@ -328,13 +328,11 @@ configure(javaCodeCheckedProjects) {
328328
}
329329

330330
checkstyle {
331-
toolVersion = "7.4"
332-
configFile = new File(configDir, 'checkstyle.xml')
333-
configProperties.checkstyleConfigDir = configDir
331+
toolVersion = "9.1"
334332
}
335333

336334
spotbugs {
337-
excludeFilter = new File(configDir, 'findbugs-exclude.xml')
335+
excludeFilter = new File(configDir, 'spotbugs/exclude.xml')
338336
}
339337

340338
codenarc {

config/checkstyle.xml renamed to config/checkstyle/checkstyle.xml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,27 @@
7878
<!-- <property name="fileExtensions" value="java"/> -->
7979
<!-- </module> -->
8080

81+
<!-- Checks for Size Violations. -->
82+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
83+
<module name="LineLength">
84+
<property name="max" value="140"/>
85+
<property name="ignorePattern" value="^.*[(http://|https://)|{@see|{@link].*$"/>
86+
</module>
87+
8188
<module name="TreeWalker">
8289

8390
<!-- Checks for Javadoc comments. -->
8491
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
8592
<module name="JavadocType">
8693
<property name="scope" value="public"/>
8794
</module>
88-
<module name="JavadocMethod">
95+
<module name="JavadocStyle">
8996
<property name="scope" value="public"/>
90-
<property name="allowUndeclaredRTE" value="true"/>
97+
<property name="checkFirstSentence" value="false"/>
9198
</module>
9299
<!--<module name="JavadocVariable"/>-->
93100
<!--<module name="JavadocStyle"/>-->
94101

95-
96102
<!-- Checks for Naming Conventions. -->
97103
<!-- See http://checkstyle.sf.net/config_naming.html -->
98104
<module name="ConstantName"/>
@@ -114,14 +120,6 @@
114120
<module name="RedundantImport"/>
115121
<module name="UnusedImports"/>
116122

117-
118-
<!-- Checks for Size Violations. -->
119-
<!-- See http://checkstyle.sf.net/config_sizes.html -->
120-
<module name="LineLength">
121-
<property name="max" value="140"/>
122-
<property name="ignorePattern" value="^.*[(http://|https://)|{@see|{@link].*$"/>
123-
</module>
124-
125123
<module name="MethodLength"/>
126124
<module name="ParameterNumber">
127125
<property name="max" value="12"/>
@@ -199,8 +197,6 @@
199197
<!--<module name="TodoComment"/>-->
200198
<module name="UpperEll"/>
201199

202-
<module name="FileContentsHolder"/>
203-
204200
<!--System.out.println not allowed-->
205201
<module name="Regexp">
206202
<property name="format" value="System\.out\.println"/>
@@ -221,16 +217,18 @@
221217
<property name="illegalPattern" value="true"/>
222218
<property name="ignoreComments" value="true"/>
223219
</module>
224-
</module>
225-
<module name="SuppressionCommentFilter"/>
226-
<module name="SuppressionCommentFilter">
227-
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
228-
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
229-
<property name="checkFormat" value="$1"/>
220+
221+
<module name="SuppressionCommentFilter"/>
222+
<module name="SuppressionCommentFilter">
223+
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
224+
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
225+
<property name="checkFormat" value="$1"/>
226+
</module>
227+
230228
</module>
231229

232230
<module name="SuppressionFilter">
233-
<property name="file" value="${checkstyleConfigDir}/checkstyle-exclude.xml"/>
231+
<property name="file" value="${config_loc}/suppressions.xml"/>
234232
</module>
235233

236234
</module>

config/checkstyle-exclude.xml renamed to config/checkstyle/suppressions.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
<!DOCTYPE suppressions PUBLIC
2020
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
2121
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
22-
2322
<suppressions>
24-
23+
<!-- vendored code -->
2524
<suppress checks="[a-zA-Z0-9]*" files="com[\\/]mongodb[\\/]internal[\\/]connection[\\/]tlschannel[\\/]"/>
2625

26+
<!-- MongoDriverVersion (generated code) -->
27+
<suppress checks="[a-zA-Z0-9]*" files="com[\\/]mongodb[\\/]internal[\\/]build[\\/]MongoDriverVersion.java" />
28+
2729
<suppress checks="MethodLength" files="QuickTour"/>
2830
<suppress checks="Regexp" files="Tour"/>
2931

@@ -60,6 +62,10 @@
6062
<!--Do not check test classes -->
6163
<suppress checks="Javadoc*" files=".*test.*"/>
6264

65+
<!--Do not check tour / helpers classes -->
66+
<suppress checks="Javadoc*" files=".*tour.*"/>
67+
<suppress checks="Javadoc*" files=".*helpers.*"/>
68+
6369
<!--Do not check The GridFSTour -->
6470
<suppress checks="Regexp" files="GridFSTour"/>
6571
<suppress checks="MethodLength" files="GridFSTour"/>
File renamed without changes.

config/findbugs-exclude.xml renamed to config/spotbugs/exclude.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@
2323
<Bug code="EI,EI2"/>
2424
</Match>
2525

26+
<Match>
27+
<Class name="org.bson.types.ObjectId"/>
28+
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>
29+
</Match>
30+
31+
<Match>
32+
<Class name="com.mongodb.internal.connection.AwsAuthenticator$AwsSaslClient"/>
33+
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>
34+
</Match>
35+
36+
<Match>
37+
<Class name="com.mongodb.internal.connection.ScramShaAuthenticator$DefaultRandomStringGenerator"/>
38+
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>
39+
</Match>
40+
41+
<Match>
42+
<Class name="org.bson.codecs.BsonValueCodecProvider"/>
43+
<Method name="getBsonTypeClassMap"/>
44+
<Bug pattern="MS_EXPOSE_REP"/>
45+
</Match>
2646

2747
<!-- these specific issues are deliberate design decisions -->
2848

0 commit comments

Comments
 (0)