api / org.gradle.api.plugins.quality / FindBugs

FindBugs

@CacheableTask open class FindBugs : SourceTask, VerificationTask, Reporting<FindBugsReports>

Analyzes code with FindBugs. See the FindBugs Manual for additional information on configuration options.

Constructors

<init>

FindBugs()

Functions

extraArgs

open fun extraArgs(arguments: MutableIterable<String>): FindBugs
open fun extraArgs(vararg arguments: String): FindBugs

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.

getClasses

open fun getClasses(): FileCollection

The class directories to be analyzed.

getClasspath

open fun getClasspath(): FileCollection

Compile class path for the classes to be analyzed. The classes on this class path are used during analysis but aren't analyzed themselves.

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.

getFindbugsClasspath

open fun getFindbugsClasspath(): FileCollection

Class path holding the FindBugs library.

getIgnoreFailures

open fun getIgnoreFailures(): Boolean

Whether to allow the build to continue if there are warnings.

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=...

getMaxHeapSize

open fun getMaxHeapSize(): String

The maximum heap size for the forked findbugs process (ex: '1g').

getObjectFactory

open fun getObjectFactory(): ObjectFactory

Injects and returns an instance of org.gradle.api.model.ObjectFactory.

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.

getPluginClasspath

open fun getPluginClasspath(): FileCollection

Class path holding any additional FindBugs plugins.

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.

getReports

open fun getReports(): FindBugsReports

The reports to be generated by this task.

getShowProgress

open fun getShowProgress(): Boolean

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

getSource

open fun getSource(): FileTree

{@inheritDoc}

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.

getWorkerProcessBuilderFactory

open fun getWorkerProcessBuilderFactory(): WorkerProcessFactory

jvmArgs

open fun jvmArgs(arguments: MutableIterable<String>): FindBugs
open fun jvmArgs(vararg arguments: String): FindBugs

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=...

reports

open fun reports(closure: Closure<Any>): FindBugsReports
open fun reports(configureAction: Action<in FindBugsReports>): FindBugsReports

Configures the reports to be generated by this task. The contained reports can be configured by name and closures. Example:

 findbugsTask { reports { xml { destination "build/findbugs.xml" } } } 

run

open fun run(): Unit

setClasses

open fun setClasses(classes: FileCollection): Unit

The class directories to be analyzed.

setClasspath

open fun setClasspath(classpath: FileCollection): Unit

Compile class path for the classes to be analyzed. The classes on this class path are used during analysis but aren't analyzed themselves.

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.

setFindbugsClasspath

open fun setFindbugsClasspath(findbugsClasspath: FileCollection): Unit

Class path holding the FindBugs library.

setIgnoreFailures

open fun setIgnoreFailures(ignoreFailures: Boolean): Unit

Whether to allow the build to continue if there are warnings.

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=...

setMaxHeapSize

open fun setMaxHeapSize(maxHeapSize: String): Unit

The maximum heap size for the forked findbugs process (ex: '1g').

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.

setPluginClasspath

open fun setPluginClasspath(pluginClasspath: FileCollection): Unit

Class path holding any additional FindBugs plugins.

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

exclude

open fun exclude(vararg excludes: String): SourceTask
open fun exclude(excludes: MutableIterable<String>): SourceTask
open fun exclude(excludeSpec: Spec<FileTreeElement>): SourceTask
open fun exclude(excludeSpec: Closure<Any>): SourceTask

{@inheritDoc}

getExcludes

open fun getExcludes(): MutableSet<String>

{@inheritDoc}

getIncludes

open fun getIncludes(): MutableSet<String>

{@inheritDoc}

include

open fun include(vararg includes: String): SourceTask
open fun include(includes: MutableIterable<String>): SourceTask
open fun include(includeSpec: Spec<FileTreeElement>): SourceTask
open fun include(includeSpec: Closure<Any>): SourceTask

{@inheritDoc}

setExcludes

open fun setExcludes(excludes: MutableIterable<String>): SourceTask

{@inheritDoc}

setIncludes

open fun setIncludes(includes: MutableIterable<String>): SourceTask

{@inheritDoc}

setSource

open fun setSource(source: FileTree): Unit

Sets the source for this task.

open fun setSource(source: Any): Unit

Sets the source for this task. The given source object is evaluated as per org.gradle.api.Project#files(Object...).

source

open fun source(vararg sources: Any): SourceTask

Adds some source to this task. The given source objects will be evaluated as per org.gradle.api.Project#files(Object...).