class SpotBugsExtension extends Object
The extension to configure the SpotBugs Gradle plugin. Most of properties in this extension will be used as the default property of all SpotBugsTask. All properties are optional.
Usage:
After you apply the SpotBugs Gradle plugin to project, write extension like below:
spotbugs {
ignoreFailures = false
showStackTraces = true
showProgress = false
reportLevel = 'default'
effort = 'default'
visitors = [ 'FindSqlInjection', 'SwitchFallthrough' ]
omitVisitors = [ 'FindNonShortCircuit' ]
reportsDir = file("$buildDir/reports/spotbugs")
includeFilter = file('spotbugs-include.xml')
excludeFilter = file('spotbugs-exclude.xml')
onlyAnalyze = ['com.foobar.MyClass', 'com.foobar.mypkg.*']
projectName = name
release = version
extraArgs = [ '-nested:false' ]
jvmArgs = [ '-Duser.language=ja' ]
maxHeapSize = '512m'
}
See also SpotBugs Manual about configuration.
Type | Name and description |
---|---|
static String |
DEFAULT_REPORTS_DIR_NAME |
RegularFileProperty |
baselineFile Property to set the baseline file. |
Property<Effort> |
effort Property to adjust SpotBugs detectors. |
RegularFileProperty |
excludeFilter Property to set the filter file to limit which bug should be reported. |
ListProperty<String> |
extraArgs Property to specify the extra arguments for SpotBugs. |
Property<Boolean> |
ignoreFailures |
RegularFileProperty |
includeFilter Property to set the filter file to limit which bug should be reported. |
ListProperty<String> |
jvmArgs Property to specify the extra arguments for JVM process. |
Property<String> |
maxHeapSize Property to specify the max heap size ( -Xmx option) of JVM process.
|
ListProperty<String> |
omitVisitors Property to disable visitors (detectors) for analysis. |
ListProperty<String> |
onlyAnalyze Property to specify the target classes for analysis. |
Property<String> |
projectName Property to specify the name of project. |
Property<String> |
release Property to specify the release identifier of project. |
Property<com.github.spotbugs.snom.Confidence> |
reportLevel Property to specify the level to report bugs. |
DirectoryProperty |
reportsDir Property to set the directory to generate report files. |
Property<Boolean> |
showProgress Property to enable progress reporting during the analysis. |
Property<Boolean> |
showStackTraces |
Property<String> |
toolVersion |
Property<Boolean> |
useAuxclasspathFile |
Property<Boolean> |
useJavaToolchains |
ListProperty<String> |
visitors Property to enable visitors (detectors) for analysis. |
Constructor and description |
---|
SpotBugsExtension
(Project project, ObjectFactory objects) |
Property to set the baseline file. This file is a Spotbugs result file, and all bugs reported in this file will not be reported in the final output.
Property to adjust SpotBugs detectors. Default value is Effort.DEFAULT.
Property to set the filter file to limit which bug should be reported.
Note that this property will NOT limit which bug should be detected. To limit the target classes to analyze, use onlyAnalyze instead. To limit the visitors (detectors) to run, use visitors and omitVisitors instead.
See also SpotBugs Manual about Filter file.
Property to specify the extra arguments for SpotBugs. Default value is empty so SpotBugs will get no extra argument.
Property to set the filter file to limit which bug should be reported.
Note that this property will NOT limit which bug should be detected. To limit the target classes to analyze, use onlyAnalyze instead. To limit the visitors (detectors) to run, use visitors and omitVisitors instead.
See also SpotBugs Manual about Filter file.
Property to specify the extra arguments for JVM process. Default value is empty so JVM process will get no extra argument.
Property to specify the max heap size (-Xmx
option) of JVM process.
Default value is empty so the default configuration made by Gradle will be used.
Property to disable visitors (detectors) for analysis. Default is empty that means SpotBugs omits no visitor.
Property to specify the target classes for analysis. Default value is empty that means all classes are analyzed.
Property to specify the name of project. Some reporting formats use this property. Default value is the name of your Gradle project.
Property to specify the release identifier of project. Some reporting formats use this property. Default value is the version of your Gradle project.
Property to specify the level to report bugs. Default value is com.github.spotbugs.snom.Confidence#DEFAULT.
Property to set the directory to generate report files. Default is "$buildDir/reports/spotbugs"
.
Note that each SpotBugsTask creates own sub-directory in this directory.
Property to enable progress reporting during the analysis. Default value is false
.
Property to enable visitors (detectors) for analysis. Default is empty that means all visitors run analysis.
Groovy Documentation