@@ -45,7 +45,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
45
45
*
46
46
* @since 1.0.0
47
47
*/
48
- @Parameter (defaultValue = " false" , property = " spotbugs.xmlOutput" , required = true )
48
+ @Parameter (defaultValue = ' false' , property = ' spotbugs.xmlOutput' , required = true )
49
49
boolean xmlOutput
50
50
51
51
/**
@@ -69,7 +69,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
69
69
*
70
70
* @since 3.1.12.2
71
71
*/
72
- @Parameter (defaultValue = " spotbugsXml.xml" , property = " spotbugs.outputXmlFilename" )
72
+ @Parameter (defaultValue = ' spotbugsXml.xml' , property = ' spotbugs.outputXmlFilename' )
73
73
String spotbugsXmlOutputFilename
74
74
75
75
/* * Doxia Site Renderer. */
@@ -97,15 +97,15 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
97
97
*
98
98
* @since 2.0
99
99
*/
100
- @Parameter (defaultValue = " false" , property = " spotbugs.includeTests" )
100
+ @Parameter (defaultValue = ' false' , property = ' spotbugs.includeTests' )
101
101
boolean includeTests
102
102
103
103
/* * List of artifacts this plugin depends on. Used for resolving the Spotbugs core plugin. */
104
- @Parameter (property = " plugin.artifacts" , required = true , readonly = true )
104
+ @Parameter (property = ' plugin.artifacts' , readonly = true , required = true )
105
105
List pluginArtifacts
106
106
107
107
/* * Maven Session. */
108
- @Parameter (defaultValue = ' ${session}' , required = true , readonly = true )
108
+ @Parameter (defaultValue = ' ${session}' , readonly = true , required = true )
109
109
MavenSession session
110
110
111
111
/**
@@ -114,7 +114,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
114
114
*
115
115
* @since 2.2
116
116
*/
117
- @Parameter (defaultValue = ' ${project.build.sourceEncoding}' , property = " encoding" )
117
+ @Parameter (defaultValue = ' ${project.build.sourceEncoding}' , property = ' encoding' )
118
118
String sourceEncoding
119
119
120
120
/**
@@ -123,11 +123,14 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
123
123
*
124
124
* @since 2.2
125
125
*/
126
- @Parameter (defaultValue = ' ${project.reporting.outputEncoding}' , property = " outputEncoding" )
126
+ @Parameter (defaultValue = ' ${project.reporting.outputEncoding}' , property = ' outputEncoding' )
127
127
String outputEncoding
128
128
129
- /* * Threshold of minimum bug severity to report. Valid values are High, Default, Low, Ignore, and Exp (for experimental). */
130
- @Parameter (defaultValue = " Default" , property = " spotbugs.threshold" )
129
+ /**
130
+ * Threshold of minimum bug severity to report. Valid values are 'High', 'Default', 'Low', 'Ignore',
131
+ * and 'Exp' (for experimental).
132
+ */
133
+ @Parameter (defaultValue = ' Default' , property = ' spotbugs.threshold' )
131
134
String threshold
132
135
133
136
/* * Artifact resolver, needed to download the coreplugin jar. */
@@ -147,7 +150,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
147
150
*
148
151
* @since 1.0-beta-1
149
152
*/
150
- @Parameter (property = " spotbugs.includeFilterFile" )
153
+ @Parameter (property = ' spotbugs.includeFilterFile' )
151
154
String includeFilterFile
152
155
153
156
/**
@@ -163,7 +166,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
163
166
*
164
167
* @since 1.0-beta-1
165
168
*/
166
- @Parameter (property = " spotbugs.excludeFilterFile" )
169
+ @Parameter (property = ' spotbugs.excludeFilterFile' )
167
170
String excludeFilterFile
168
171
169
172
/**
@@ -180,19 +183,19 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
180
183
*
181
184
* @since 2.4.1
182
185
*/
183
- @Parameter (property = " spotbugs.excludeBugsFile" )
186
+ @Parameter (property = ' spotbugs.excludeBugsFile' )
184
187
String excludeBugsFile
185
188
186
189
/**
187
190
* Effort of the bug finders. Valid values are Min, Default and Max.
188
191
*
189
192
* @since 1.0-beta-1
190
193
*/
191
- @Parameter (defaultValue = " Default" , property = " spotbugs.effort" )
194
+ @Parameter (defaultValue = ' Default' , property = ' spotbugs.effort' )
192
195
String effort
193
196
194
197
/* * Turn on Spotbugs debugging. */
195
- @Parameter (defaultValue = " false" , property = " spotbugs.debug" )
198
+ @Parameter (defaultValue = ' false' , property = ' spotbugs.debug' )
196
199
boolean debug
197
200
198
201
/**
@@ -201,23 +204,23 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
201
204
*
202
205
* @since 1.1
203
206
*/
204
- @Parameter (defaultValue = " false" , property = " spotbugs.relaxed" )
207
+ @Parameter (defaultValue = ' false' , property = ' spotbugs.relaxed' )
205
208
boolean relaxed
206
209
207
210
/**
208
211
* The visitor list to run. This is a comma-delimited list.
209
212
*
210
213
* @since 1.0-beta-1
211
214
*/
212
- @Parameter (property = " spotbugs.visitors" )
215
+ @Parameter (property = ' spotbugs.visitors' )
213
216
String visitors
214
217
215
218
/**
216
219
* The visitor list to omit. This is a comma-delimited list.
217
220
*
218
221
* @since 1.0-beta-1
219
222
*/
220
- @Parameter (property = " spotbugs.omitVisitors" )
223
+ @Parameter (property = ' spotbugs.omitVisitors' )
221
224
String omitVisitors
222
225
223
226
/**
@@ -232,15 +235,15 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
232
235
*
233
236
* @since 1.0-beta-1
234
237
*/
235
- @Parameter (property = " spotbugs.pluginList" )
238
+ @Parameter (property = ' spotbugs.pluginList' )
236
239
String pluginList
237
240
238
241
/**
239
242
* Restrict analysis to the given comma-separated list of classes and packages.
240
243
*
241
244
* @since 1.1
242
245
*/
243
- @Parameter (property = " spotbugs.onlyAnalyze" )
246
+ @Parameter (property = ' spotbugs.onlyAnalyze' )
244
247
String onlyAnalyze
245
248
246
249
/**
@@ -249,7 +252,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
249
252
*
250
253
* @since 2.3.2
251
254
*/
252
- @Parameter (property = " spotbugs.nested " , defaultValue = " false " )
255
+ @Parameter (defaultValue = ' false ' , property = ' spotbugs.nested ' )
253
256
boolean nested
254
257
255
258
/**
@@ -258,23 +261,23 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
258
261
*
259
262
* @since 2.3.2
260
263
*/
261
- @Parameter (property = " spotbugs.trace " , defaultValue = " false " )
264
+ @Parameter (defaultValue = ' false ' , property = ' spotbugs.trace ' )
262
265
boolean trace
263
266
264
267
/**
265
268
* Maximum bug ranking to record.
266
269
*
267
270
* @since 2.4.1
268
271
*/
269
- @Parameter (property = " spotbugs.maxRank" )
272
+ @Parameter (property = ' spotbugs.maxRank' )
270
273
int maxRank
271
274
272
275
/**
273
276
* Skip entire check.
274
277
*
275
278
* @since 1.1
276
279
*/
277
- @Parameter (property = " spotbugs.skip " , defaultValue = " false " )
280
+ @Parameter (defaultValue = ' false ' , property = ' spotbugs.skip ' )
278
281
boolean skip
279
282
280
283
/**
@@ -298,7 +301,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
298
301
*
299
302
* @since 2.0
300
303
*/
301
- @Parameter (property = " spotbugs.failOnError " , defaultValue = " true " )
304
+ @Parameter (defaultValue = ' true ' , property = ' spotbugs.failOnError ' )
302
305
boolean failOnError
303
306
304
307
/**
@@ -307,15 +310,15 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
307
310
*
308
311
* @since 4.0.1
309
312
*/
310
- @Parameter (property = " spotbugs.failThreshold" )
313
+ @Parameter (property = ' spotbugs.failThreshold' )
311
314
String failThreshold
312
315
313
316
/**
314
317
* Fork a VM for Spotbugs analysis. This will allow you to set timeouts and heap size.
315
318
*
316
319
* @since 2.3.2
317
320
*/
318
- @Parameter (property = " spotbugs.fork " , defaultValue = " true " )
321
+ @Parameter (defaultValue = ' true ' , property = ' spotbugs.fork ' )
319
322
boolean fork
320
323
321
324
/**
@@ -324,7 +327,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
324
327
*
325
328
* @since 2.2
326
329
*/
327
- @Parameter (property = " spotbugs.maxHeap " , defaultValue = " 512 " )
330
+ @Parameter (defaultValue = ' 512 ' , property = ' spotbugs.maxHeap ' )
328
331
int maxHeap
329
332
330
333
/**
@@ -335,45 +338,45 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
335
338
*
336
339
* @since 2.2
337
340
*/
338
- @Parameter (property = " spotbugs.timeout " , defaultValue = " 600000 " )
341
+ @Parameter (defaultValue = ' 600000 ' , property = ' spotbugs.timeout ' )
339
342
int timeout
340
343
341
344
/**
342
345
* The arguments to pass to the forked VM (ignored if fork is disabled).
343
346
*
344
347
* @since 2.4.1
345
348
*/
346
- @Parameter (property = " spotbugs.jvmArgs" )
349
+ @Parameter (property = ' spotbugs.jvmArgs' )
347
350
String jvmArgs
348
351
349
352
/**
350
353
* specified max number of violations which can be ignored by the spotbugs.
351
354
*
352
355
* @since 2.4.1
353
356
*/
354
- @Parameter (property = " spotbugs.maxAllowedViolations " , defaultValue = " 0 " )
357
+ @Parameter (defaultValue = ' 0 ' , property = ' spotbugs.maxAllowedViolations ' )
355
358
int maxAllowedViolations
356
359
357
360
/* * Disable bugs log. */
358
- @Parameter (defaultValue = " false" , property = " spotbugs.quiet" )
361
+ @Parameter (defaultValue = ' false' , property = ' spotbugs.quiet' )
359
362
boolean quiet
360
363
361
364
@Override
362
365
void execute () {
363
- log. debug(" Executing spotbugs:check" )
366
+ log. debug(' Executing spotbugs:check' )
364
367
365
368
if (skip) {
366
- log. info(" Spotbugs plugin skipped" )
369
+ log. info(' Spotbugs plugin skipped' )
367
370
return
368
371
} else if (! doSourceFilesExist()) {
369
- log. debug(" Nothing for SpotBugs to do here." )
372
+ log. debug(' Nothing for SpotBugs to do here.' )
370
373
return
371
374
}
372
375
373
- log. debug(" Here goes...............Executing spotbugs:check" )
376
+ log. debug(' Here goes...............Executing spotbugs:check' )
374
377
375
378
if (! spotbugsXmlOutputDirectory. exists() && ! spotbugsXmlOutputDirectory. mkdirs()) {
376
- throw new MojoExecutionException (" Cannot create xml output directory" )
379
+ throw new MojoExecutionException (' Cannot create xml output directory' )
377
380
}
378
381
379
382
File outputFile = new File (" ${ spotbugsXmlOutputDirectory} /${ spotbugsXmlOutputFilename} " )
@@ -393,7 +396,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
393
396
log. info(' No errors/warnings found' )
394
397
return
395
398
} else if (maxAllowedViolations > 0 && bugCount <= maxAllowedViolations) {
396
- log. info(" total ${ bugCount} violations are found which is set to be acceptable using configured property maxAllowedViolations :" + maxAllowedViolations + " . " + SpotBugsInfo . EOL + " Below are list of bugs ignored :" + SpotBugsInfo . EOL )
399
+ log. info(" total ${ bugCount} violations are found which is set to be acceptable using configured property maxAllowedViolations :${ maxAllowedViolations} . ${ SpotBugsInfo.EOL} Below are list of bugs ignored :${ SpotBugsInfo.EOL} " )
397
400
printBugs(bugCount, bugs)
398
401
return
399
402
}
@@ -427,7 +430,7 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
427
430
log. info(SpotBugsInfo . EOL + SpotBugsInfo . EOL + SpotBugsInfo . EOL + ' To see bug detail using the Spotbugs GUI, use the following command "mvn spotbugs:gui"' + SpotBugsInfo . EOL + SpotBugsInfo . EOL + SpotBugsInfo . EOL )
428
431
429
432
if ((bugCountAboveThreshold || errorCount) && failOnError) {
430
- throw new MojoExecutionException (" failed with ${ bugCountAboveThreshold} bugs and ${ errorCount} errors " )
433
+ throw new MojoExecutionException (" failed with ${ bugCountAboveThreshold} bugs and ${ errorCount} errors" )
431
434
}
432
435
}
433
436
}
@@ -436,16 +439,16 @@ abstract class BaseViolationCheckMojo extends AbstractMojo {
436
439
Collection<File > sourceFiles = new ArrayList<> ()
437
440
438
441
if (this . classFilesDirectory. isDirectory()) {
439
- log. debug(" looking for class files with extensions: " + SpotBugsInfo . EXTENSIONS )
442
+ log. debug(' looking for class files with extensions: ' + SpotBugsInfo . EXTENSIONS )
440
443
sourceFiles. addAll(FileUtils . listFiles(classFilesDirectory, SpotBugsInfo . EXTENSIONS , true ))
441
444
}
442
445
443
446
if (this . includeTests && this . testClassFilesDirectory. isDirectory()) {
444
- log. debug(" looking for test class files: " + SpotBugsInfo . EXTENSIONS )
447
+ log. debug(' looking for test class files: ' + SpotBugsInfo . EXTENSIONS )
445
448
sourceFiles. addAll(FileUtils . listFiles(testClassFilesDirectory, SpotBugsInfo . EXTENSIONS , true ))
446
449
}
447
450
448
- log. debug(" SourceFiles: " + Arrays . toString(sourceFiles));
451
+ log. debug(' SourceFiles: ' + Arrays . toString(sourceFiles));
449
452
! sourceFiles. isEmpty()
450
453
}
451
454
0 commit comments