api / org.gradle.api.plugins.quality / FindBugsExtension

FindBugsExtension

open class FindBugsExtension : CodeQualityExtension

Configuration options for the FindBugs plugin. All options have sensible defaults. See the FindBugs Manual for additional information on these options.

Below is a full configuration example. Since all properties have sensible defaults, typically only selected properties will be configured.

 apply plugin: "java" apply plugin: "findbugs" findbugs { toolVersion = "2.0.1" sourceSets = [sourceSets.main] ignoreFailures = true reportsDir = file("$project.buildDir/findbugsReports") effort = "max" showProgress = true reportLevel = "high" visitors = ["FindSqlInjection", "SwitchFallthrough"] omitVisitors = ["FindNonShortCircuit"] includeFilter = file("$rootProject.projectDir/config/findbugs/includeFilter.xml") excludeFilter = file("$rootProject.projectDir/config/findbugs/excludeFilter.xml") excludeBugsFilter = file("$rootProject.projectDir/config/findbugs/excludeBugsFilter.xml") } 

See Also
FindBugsPlugin

Constructors

<init>

FindBugsExtension(project: Project)

Functions

getEffort

open fun getEffort(): String

The analysis effort level. The value specified should be one of min, default, or max. Higher levels increase precision and find more bugs at the expense of running time and memory consumption.

getExcludeBugsFilter

open fun getExcludeBugsFilter(): File

The filename of a filter specifying baseline bugs to exclude from being reported.

getExcludeBugsFilterConfig

open fun getExcludeBugsFilterConfig(): TextResource

A filter specifying baseline bugs to exclude from being reported.

getExcludeFilter

open fun getExcludeFilter(): File

The filename of a filter specifying bugs to exclude from being reported.

getExcludeFilterConfig

open fun getExcludeFilterConfig(): TextResource

A filter specifying bugs to exclude from being reported. Replaces the excludeFilter property.

getExtraArgs

open fun getExtraArgs(): MutableCollection<String>

Any additional arguments (not covered here more explicitly like effort) to be passed along to FindBugs.

Extra arguments are passed to FindBugs after the arguments Gradle understands (like effort but before the list of classes to analyze. This should only be used for arguments that cannot be provided by Gradle directly. Gradle does not try to interpret or validate the arguments before passing them to FindBugs.

See the FindBugs TextUICommandLine source for available options.

getIncludeFilter

open fun getIncludeFilter(): File

The filename of a filter specifying which bugs are reported.

getIncludeFilterConfig

open fun getIncludeFilterConfig(): TextResource

A filter specifying which bugs are reported. Replaces the includeFilter property.

getJvmArgs

open fun getJvmArgs(): MutableCollection<String>

Any additional arguments to be passed along to FindBugs JVM process.

Arguments can contain general JVM flags like -Xdebug and also FindBugs system properties like -Dfindbugs.loadPropertiesFrom=...

getOmitVisitors

open fun getOmitVisitors(): MutableCollection<String>

Similar to visitors except that it specifies bug detectors which should not be run. By default, no visitors are omitted.

getReportLevel

open fun getReportLevel(): String

The priority threshold for reporting bugs. If set to low, all bugs are reported. If set to medium (the default), medium and high priority bugs are reported. If set to high, only high priority bugs are reported.

getVisitors

open fun getVisitors(): MutableCollection<String>

The bug detectors which should be run. The bug detectors are specified by their class names, without any package qualification. By default, all detectors which are not disabled by default are run.

isShowProgress

open fun isShowProgress(): Boolean

Indicates whether analysis progress should be rendered on standard output. Defaults to false.

setEffort

open fun setEffort(effort: String): Unit

The analysis effort level. The value specified should be one of min, default, or max. Higher levels increase precision and find more bugs at the expense of running time and memory consumption.

setExcludeBugsFilter

open fun setExcludeBugsFilter(filter: File): Unit

The filename of a filter specifying baseline bugs to exclude from being reported.

setExcludeBugsFilterConfig

open fun setExcludeBugsFilterConfig(excludeBugsFilterConfig: TextResource): Unit

A filter specifying baseline bugs to exclude from being reported.

setExcludeFilter

open fun setExcludeFilter(filter: File): Unit

The filename of a filter specifying bugs to exclude from being reported.

setExcludeFilterConfig

open fun setExcludeFilterConfig(excludeFilterConfig: TextResource): Unit

A filter specifying bugs to exclude from being reported. Replaces the excludeFilter property.

setExtraArgs

open fun setExtraArgs(extraArgs: MutableCollection<String>): Unit

Any additional arguments (not covered here more explicitly like effort) to be passed along to FindBugs.

Extra arguments are passed to FindBugs after the arguments Gradle understands (like effort but before the list of classes to analyze. This should only be used for arguments that cannot be provided by Gradle directly. Gradle does not try to interpret or validate the arguments before passing them to FindBugs.

See the FindBugs TextUICommandLine source for available options.

setIncludeFilter

open fun setIncludeFilter(filter: File): Unit

The filename of a filter specifying which bugs are reported.

setIncludeFilterConfig

open fun setIncludeFilterConfig(includeFilterConfig: TextResource): Unit

A filter specifying which bugs are reported. Replaces the includeFilter property.

setJvmArgs

open fun setJvmArgs(jvmArgs: MutableCollection<String>): Unit

Any additional arguments to be passed along to FindBugs JVM process.

Arguments can contain general JVM flags like -Xdebug and also FindBugs system properties like -Dfindbugs.loadPropertiesFrom=...

setOmitVisitors

open fun setOmitVisitors(omitVisitors: MutableCollection<String>): Unit

Similar to visitors except that it specifies bug detectors which should not be run. By default, no visitors are omitted.

setReportLevel

open fun setReportLevel(reportLevel: String): Unit

The priority threshold for reporting bugs. If set to low, all bugs are reported. If set to medium (the default), medium and high priority bugs are reported. If set to high, only high priority bugs are reported.

setShowProgress

open fun setShowProgress(showProgress: Boolean): Unit

Indicates whether analysis progress should be rendered on standard output.

setVisitors

open fun setVisitors(visitors: MutableCollection<String>): Unit

The bug detectors which should be run. The bug detectors are specified by their class names, without any package qualification. By default, all detectors which are not disabled by default are run.

Inherited Functions

getReportsDir

open fun getReportsDir(): File

The directory where reports will be generated.

getSourceSets

open fun getSourceSets(): MutableCollection<SourceSet>

The source sets to be analyzed as part of the check and build tasks.

getToolVersion

open fun getToolVersion(): String

The version of the code quality tool to be used.

isIgnoreFailures

open fun isIgnoreFailures(): Boolean

Whether to allow the build to continue if there are warnings. Example: ignoreFailures = true

setIgnoreFailures

open fun setIgnoreFailures(ignoreFailures: Boolean): Unit

Whether to allow the build to continue if there are warnings. Example: ignoreFailures = true

setReportsDir

open fun setReportsDir(reportsDir: File): Unit

The directory where reports will be generated.

setSourceSets

open fun setSourceSets(sourceSets: MutableCollection<SourceSet>): Unit

The source sets to be analyzed as part of the check and build tasks.

setToolVersion

open fun setToolVersion(toolVersion: String): Unit

The version of the code quality tool to be used.

Extension Properties

ext

val FindBugsExtension.ext: ExtraPropertiesExtension

Retrieves the ext extension.

Extension Functions

ext

fun FindBugsExtension.ext(configure: ExtraPropertiesExtension.() -> Unit): Unit

Configures the ext extension.