Skip to content

Commit 9ab1a71

Browse files
stIncMalejyemin
authored andcommitted
Augment config/spotbugs/exclude.xml with finding status and rank (#1392)
JAVA-5431
1 parent b10358d commit 9ab1a71

File tree

1 file changed

+48
-111
lines changed

1 file changed

+48
-111
lines changed

config/spotbugs/exclude.xml

Lines changed: 48 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -14,251 +14,186 @@
1414
~ limitations under the License.
1515
-->
1616

17+
<!-- See https://spotbugs.readthedocs.io/en/latest/filter.html#rank
18+
for the mapping from SpotBugs rank to verbal labels.
19+
-->
1720
<FindBugsFilter>
18-
<!-- specific excludes which should be fixed -->
1921
<Match>
20-
<Class name="org.bson.JSONWriterSettings"/>
21-
</Match>
22-
<Match>
23-
<Bug code="EI,EI2"/>
22+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 18 -->
23+
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
2424
</Match>
2525

2626
<Match>
27+
<!-- MongoDB status: "False Positive", SpotBugs rank: 14 -->
2728
<Class name="org.bson.types.ObjectId"/>
2829
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>
2930
</Match>
3031

32+
<!-- Once we stop supporting Java SE 8,
33+
we can start relying on `SecureRandom` being thread-safe,
34+
as per https://docs.oracle.com/javase/9/docs/api/java/security/SecureRandom.html,
35+
and reuse its instances. -->
3136
<Match>
37+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 14 -->
3238
<Class name="com.mongodb.internal.connection.AwsAuthenticator$AwsSaslClient"/>
3339
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>
3440
</Match>
35-
3641
<Match>
42+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 14 -->
3743
<Class name="com.mongodb.internal.connection.ScramShaAuthenticator$DefaultRandomStringGenerator"/>
3844
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE"/>
3945
</Match>
4046

4147
<Match>
48+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 18 -->
4249
<Class name="org.bson.codecs.BsonValueCodecProvider"/>
4350
<Method name="getBsonTypeClassMap"/>
4451
<Bug pattern="MS_EXPOSE_REP"/>
4552
</Match>
4653

47-
<!-- these specific issues are deliberate design decisions -->
48-
49-
<!-- Deliberately ignoring this, as the check for a null SSLParameters is actually necessary.
50-
See https://jira.mongodb.org/browse/JAVA-2876 for details. -->
5154
<Match>
55+
<!-- MongoDB status: "False Positive", SpotBugs rank: 18 -->
56+
<!-- Deliberately ignoring this, as the check for a null SSLParameters is actually necessary.
57+
See https://jira.mongodb.org/browse/JAVA-2876 for details. -->
5258
<Class name="com.mongodb.client.internal.KeyManagementService"/>
5359
<Method name="enableHostNameVerification" params="javax.net.ssl.SSLSocket"/>
5460
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
5561
</Match>
5662

57-
<!-- Deliberately ignoring this, as many BSONObject subclasses don't do it -->
5863
<Match>
64+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 17 -->
65+
<!-- Deliberately ignoring this, as many BSONObject subclasses don't do it -->
5966
<Package name="com.mongodb"/>
6067
<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
6168
</Match>
6269

63-
<!-- Deliberately ignoring return value of CountDownLatch.await -->
6470
<Match>
71+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 5 -->
72+
<!-- Deliberately ignoring return value of CountDownLatch.await -->
6573
<Class name="com.mongodb.internal.connection.BaseCluster"/>
6674
<Bug pattern="RV_RETURN_VALUE_IGNORED"/>
6775
</Match>
6876

69-
<!-- The underlying call to GridFSInputFile closes the file -->
7077
<Match>
78+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 20 -->
79+
<!-- The underlying call to GridFSInputFile closes the file -->
7180
<Class name="com.mongodb.gridfs.GridFS"/>
7281
<Method name="createFile" params="java.io.File"/>
7382
<Bug pattern="OBL_UNSATISFIED_OBLIGATION"/>
7483
</Match>
7584

76-
<Match>
77-
<Class name="com.mongodb.DocumentCodec"/>
78-
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
79-
</Match>
80-
81-
<Match>
82-
<Class name="org.mongodb.DatabaseTestCase" />
83-
<Bug pattern="MS_PKGPROTECT"/>
84-
</Match>
85-
86-
<Match>
87-
<Class name="org.mongodb.FunctionalSpecification"/>
88-
<Bug pattern="MS_PKGPROTECT"/>
89-
</Match>
90-
91-
<Match>
92-
<Class name="com.mongodb.DatabaseTestCase"/>
93-
<Bug pattern="MS_PKGPROTECT"/>
94-
</Match>
95-
96-
<Match>
97-
<Class name="org.bson.types.StringRangeSet$NumberStringComparator"/>
98-
<Bug pattern="SE_COMPARATOR_SHOULD_BE_SERIALIZABLE"/>
99-
</Match>
100-
10185
<!-- Special handling of clone method for cloneable BsonValue subclasses. By design, they don't call super.clone() -->
10286
<Match>
87+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 14 -->
10388
<Class name="org.bson.BsonArray"/>
10489
<Method name="clone"/>
10590
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
10691
</Match>
107-
10892
<Match>
93+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 14 -->
10994
<Class name="org.bson.BsonDocument"/>
11095
<Method name="clone"/>
11196
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
11297
</Match>
113-
114-
<Match>
115-
<Class name="org.bson.BsonDocumentWrapper"/>
116-
<Method name="clone"/>
117-
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
118-
</Match>
119-
12098
<Match>
99+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 16 -->
121100
<Class name="org.bson.RawBsonArray"/>
122101
<Method name="clone"/>
123102
<Bug pattern="CN_IDIOM_NO_SUPER_CALL"/>
124103
</Match>
125104

126105
<Match>
127-
<Class name="org.bson.codecs.jsr310.Jsr310CodecProvider"/>
128-
<Bug pattern="DE_MIGHT_IGNORE"/>
129-
</Match>
130-
131-
<!-- Test exclusions -->
132-
<!-- All bugs in test classes, except for JUnit-specific bugs -->
133-
<Match>
134-
<Class name="~.*\.*Test"/>
135-
<Not>
136-
<Bug code="IJU"/>
137-
</Not>
138-
</Match>
139-
140-
<!-- Deliberate use of an unused field in the Person POJO class -->
141-
<Match>
142-
<Class name="com.mongodb.acceptancetest.crud.pojo.Person"/>
143-
<Bug pattern="SS_SHOULD_BE_STATIC"/>
144-
</Match>
145-
146-
<!-- Spock tests seem to fail the serial version ID test when stubbing. Annoying. -->
147-
<Match>
148-
<Source name="~.*\.groovy"/>
149-
<Bug pattern="SE_NO_SERIALVERSIONID,LI_LAZY_INIT_STATIC,EQ_UNUSUAL,IT_NO_SUCH_ELEMENT,RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
150-
</Match>
151-
152-
<!-- Strange findbugs issues -->
153-
<Match>
154-
<Source name="~.*ClusterSettingsSpecification\.groovy"/>
155-
<Bug pattern="RANGE_ARRAY_INDEX"/>
156-
</Match>
157-
158-
<Match>
159-
<Class name="~com.mongodb.internal.connection.AbstractByteBufBsonDocument.*"/>
160-
<Bug pattern="NP_BOOLEAN_RETURN_NULL"/>
161-
</Match>
162-
163-
<Match>
106+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 16 -->
164107
<Class name="~com.mongodb.client.ClientSession.*"/>
165108
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
166109
</Match>
167110

168111
<Match>
112+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 16 -->
169113
<Class name="~com.mongodb.reactivestreams.client.ClientSession.*"/>
170114
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
171115
</Match>
172116

173117
<Match>
174-
<Class name="~com.mongodb.kotlin.client.ClientSession.*"/>
175-
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
176-
</Match>
177-
178-
<Match>
118+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 16 -->
179119
<Class name="~com.mongodb.kotlin.client.coroutine.ClientSession.*"/>
180120
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
181121
</Match>
182122

183123
<Match>
184-
<Class name="~com.mongodb.internal.async.client.ClientSession.*"/>
185-
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_INTERFACE"/>
186-
</Match>
187-
188-
<Match>
189-
<Class name="~com.mongodb.async.client.internal.AsyncCryptConnection.*"/>
190-
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
191-
</Match>
192-
193-
<!-- Spotbugs assumes that SSLSocket#getSSLParameters never returns null, when that is not the case for all JDKs -->
194-
<Match>
124+
<!-- MongoDB status: "False Positive", SpotBugs rank: 18 -->
125+
<!-- Spotbugs assumes that SSLSocket#getSSLParameters never returns null, when that is not the case for all JDKs -->
195126
<Class name="com.mongodb.internal.connection.SslHelper"/>
196127
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
197128
</Match>
198129

199130
<Match>
131+
<!-- MongoDB status: "False Positive", SpotBugs rank: 17 -->
200132
<Class name="com.mongodb.client.internal.CryptConnection"/>
201133
<Method name="retain"/>
202134
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
203135
</Match>
204136

205137
<Match>
206-
<Class name="~com.mongodb.reactivestreams.client.internal.crypt.*"/>
138+
<!-- MongoDB status: "False Positive", SpotBugs rank: 17 -->
139+
<Class name="com.mongodb.reactivestreams.client.internal.crypt.CryptConnection"/>
207140
<Method name="retain"/>
208141
<Bug pattern="RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT"/>
209142
</Match>
210143

211-
<!-- Caused by Java 11 generating a null check on try with resources.
212-
See https://github.com/spotbugs/spotbugs/issues/756 for details. -->
213144
<Match>
145+
<!-- MongoDB status: "False Positive", SpotBugs rank: 11 -->
146+
<Class name="org.bson.codecs.kotlin.DataClassCodec$Companion"/>
147+
<Method name="getCodec"/>
214148
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE"/>
215149
</Match>
216150

217-
<!-- AWS use UNIX-style line endings -->
218151
<Match>
152+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 20 -->
153+
<!-- AWS use UNIX-style line endings -->
219154
<Class name="com.mongodb.internal.connection.AuthorizationHeader"/>
220155
<Bug pattern="VA_FORMAT_STRING_USES_NEWLINE"/>
221156
</Match>
222157

223-
<!-- The method is a wrapper for `Condition.await`, naturally it does not call it in a loop. -->
224158
<Match>
159+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 14 -->
160+
<!-- The method is a wrapper for `Condition.await`, naturally it does not call it in a loop. -->
225161
<Class name="com.mongodb.internal.connection.DefaultConnectionPool$OpenConcurrencyLimiter"/>
226162
<Method name="awaitNanos"/>
227163
<Bug pattern="WA_AWAIT_NOT_IN_LOOP"/>
228164
</Match>
229165

230166
<!-- The checker fails to see that the code prevents concurrent incrementation by using exclusive locking. -->
231167
<Match>
168+
<!-- MongoDB status: "False Positive", SpotBugs rank: 14 -->
232169
<Class name="com.mongodb.internal.connection.DefaultConnectionPool$StateAndGeneration"/>
233170
<Field name="generation"/>
234171
<Bug pattern="VO_VOLATILE_INCREMENT"/>
235172
</Match>
236173
<Match>
174+
<!-- MongoDB status: "False Positive", SpotBugs rank: 14 -->
237175
<Class name="com.mongodb.internal.connection.ConcurrentPool$StateAndPermits"/>
238176
<Field name="permits"/>
239177
<Bug pattern="VO_VOLATILE_INCREMENT"/>
240178
</Match>
241179

242-
<!-- Non-short-circuit operators are used intentionally. -->
243180
<Match>
181+
<!-- MongoDB status: "No Fix Needed", SpotBugs rank: 15 -->
182+
<!-- Non-short-circuit operators are used intentionally. -->
244183
<Class name="com.mongodb.internal.connection.ConcurrentPool$StateAndPermits"/>
245184
<Method name="acquirePermit"/>
246185
<Bug pattern="NS_DANGEROUS_NON_SHORT_CIRCUIT"/>
247186
</Match>
248-
<Match>
249-
<Class name="com.mongodb.internal.connection.DefaultConnectionPool$OpenConcurrencyLimiter"/>
250-
<Method name="acquirePermitOrGetAvailableOpenedConnection"/>
251-
<Bug pattern="NS_NON_SHORT_CIRCUIT"/>
252-
</Match>
253187

254188
<!-- Kotlin false positive for validating annotations -->
255189
<Match>
190+
<!-- MongoDB status: "False Positive", SpotBugs rank: 17 -->
256191
<Class name="org.bson.codecs.kotlin.DataClassCodec$Companion"/>
257192
<Method name="~.*validateAnnotations.*"/>
258193
<Bug pattern="UC_USELESS_OBJECT"/>
259194
</Match>
260-
261195
<Match>
196+
<!-- MongoDB status: "False Positive", SpotBugs rank: 17 -->
262197
<Class name="org.bson.codecs.kotlinx.KotlinSerializerCodec$Companion"/>
263198
<Method name="~.*validateAnnotations.*"/>
264199
<Bug pattern="UC_USELESS_OBJECT"/>
@@ -268,11 +203,13 @@
268203
see: https://github.com/Kotlin/kotlinx.coroutines/issues/3099
269204
-->
270205
<Match>
206+
<!-- MongoDB status: "False Positive", SpotBugs rank: 13 -->
271207
<Class name="com.mongodb.kotlin.client.coroutine.MongoClient"/>
272208
<Method name="startSession"/>
273209
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
274210
</Match>
275211
<Match>
212+
<!-- MongoDB status: "False Positive", SpotBugs rank: 16 -->
276213
<Class name="~com.mongodb.kotlin.client.coroutine.*"/>
277214
<Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
278215
</Match>

0 commit comments

Comments
 (0)