# Class FindBugsExtension

java.lang.Object
org.gradle.api.plugins.quality.CodeQualityExtension
org.gradle.api.plugins.quality.FindBugsExtension

public class FindBugsExtension extends 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`

## Constructor Summary

Constructors
Constructor
Description
`FindBugsExtension(Project project)`

## Method Summary

Modifier and Type
Method
Description
`String`
`getEffort()`
The analysis effort level.
`File`
`getExcludeBugsFilter()`
The filename of a filter specifying baseline bugs to exclude from being reported.
`TextResource`
`getExcludeBugsFilterConfig()`
A filter specifying baseline bugs to exclude from being reported.
`File`
`getExcludeFilter()`
The filename of a filter specifying bugs to exclude from being reported.
`TextResource`
`getExcludeFilterConfig()`
A filter specifying bugs to exclude from being reported.
`Collection<String>`
`getExtraArgs()`
Any additional arguments (not covered here more explicitly like `effort`) to be passed along to FindBugs.
`File`
`getIncludeFilter()`
The filename of a filter specifying which bugs are reported.
`TextResource`
`getIncludeFilterConfig()`
A filter specifying which bugs are reported.
`Collection<String>`
`getJvmArgs()`
Any additional arguments to be passed along to FindBugs JVM process.
`Collection<String>`
`getOmitVisitors()`
Similar to `visitors` except that it specifies bug detectors which should not be run.
`String`
`getReportLevel()`
The priority threshold for reporting bugs.
`Collection<String>`
`getVisitors()`
The bug detectors which should be run.
`boolean`
`isShowProgress()`
Indicates whether analysis progress should be rendered on standard output.
`void`
`setEffort(String effort)`
The analysis effort level.
`void`
`setExcludeBugsFilter(File filter)`
The filename of a filter specifying baseline bugs to exclude from being reported.
`void`
`setExcludeBugsFilterConfig(TextResource excludeBugsFilterConfig)`
A filter specifying baseline bugs to exclude from being reported.
`void`
`setExcludeFilter(File filter)`
The filename of a filter specifying bugs to exclude from being reported.
`void`
`setExcludeFilterConfig(TextResource excludeFilterConfig)`
A filter specifying bugs to exclude from being reported.
`void`
`setExtraArgs(Collection<String> extraArgs)`
Any additional arguments (not covered here more explicitly like `effort`) to be passed along to FindBugs.
`void`
`setIncludeFilter(File filter)`
The filename of a filter specifying which bugs are reported.
`void`
`setIncludeFilterConfig(TextResource includeFilterConfig)`
A filter specifying which bugs are reported.
`void`
`setJvmArgs(Collection<String> jvmArgs)`
Any additional arguments to be passed along to FindBugs JVM process.
`void`
`setOmitVisitors(Collection<String> omitVisitors)`
Similar to `visitors` except that it specifies bug detectors which should not be run.
`void`
`setReportLevel(String reportLevel)`
The priority threshold for reporting bugs.
`void`
`setShowProgress(boolean showProgress)`
Indicates whether analysis progress should be rendered on standard output.
`void`
`setVisitors(Collection<String> visitors)`
The bug detectors which should be run.

### Methods inherited from class CodeQualityExtension

`getReportsDir, getSourceSets, getToolVersion, isIgnoreFailures, setIgnoreFailures, setReportsDir, setSourceSets, setToolVersion`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### FindBugsExtension

public FindBugsExtension(Project project)

## Method Details

### getEffort

public String getEffort()
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.

### setEffort

public void setEffort(String effort)
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.

### getReportLevel

public String getReportLevel()
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.

### setReportLevel

public void setReportLevel(String reportLevel)
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

public Collection<String> getVisitors()
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.

### setVisitors

public void setVisitors(Collection<String> visitors)
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.

### getOmitVisitors

public Collection<String> getOmitVisitors()
Similar to `visitors` except that it specifies bug detectors which should not be run. By default, no visitors are omitted.

### setOmitVisitors

public void setOmitVisitors(Collection<String> omitVisitors)
Similar to `visitors` except that it specifies bug detectors which should not be run. By default, no visitors are omitted.

### getIncludeFilterConfig

@Incubating public TextResource getIncludeFilterConfig()
A filter specifying which bugs are reported. Replaces the `includeFilter` property.

Since:
  2.2

### setIncludeFilterConfig

@Incubating public void setIncludeFilterConfig(TextResource includeFilterConfig)
A filter specifying which bugs are reported. Replaces the `includeFilter` property.

Since:
  2.2

### getIncludeFilter

public File getIncludeFilter()
The filename of a filter specifying which bugs are reported.

### setIncludeFilter

public void setIncludeFilter(File filter)
The filename of a filter specifying which bugs are reported.

### getExcludeFilterConfig

@Incubating public TextResource getExcludeFilterConfig()
A filter specifying bugs to exclude from being reported. Replaces the `excludeFilter` property.

Since:
  2.2

### setExcludeFilterConfig

@Incubating public void setExcludeFilterConfig(TextResource excludeFilterConfig)
A filter specifying bugs to exclude from being reported. Replaces the `excludeFilter` property.

Since:
  2.2

### getExcludeFilter

public File getExcludeFilter()
The filename of a filter specifying bugs to exclude from being reported.

### setExcludeFilter

public void setExcludeFilter(File filter)
The filename of a filter specifying bugs to exclude from being reported.

### getExcludeBugsFilterConfig

@Incubating public TextResource getExcludeBugsFilterConfig()
A filter specifying baseline bugs to exclude from being reported.

Since:
  2.4

### setExcludeBugsFilterConfig

@Incubating public void setExcludeBugsFilterConfig(TextResource excludeBugsFilterConfig)
A filter specifying baseline bugs to exclude from being reported.

Since:
  2.4

### getExcludeBugsFilter

public File getExcludeBugsFilter()
The filename of a filter specifying baseline bugs to exclude from being reported.

### setExcludeBugsFilter

public void setExcludeBugsFilter(File filter)
The filename of a filter specifying baseline bugs to exclude from being reported.

### getExtraArgs

public Collection<String> getExtraArgs()
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.

Since:
  2.6

### setExtraArgs

public void setExtraArgs(Collection<String> extraArgs)
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.

Since:
  2.6

### getJvmArgs

@Incubating public Collection<String> getJvmArgs()
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=...`

Since:
  4.3

### setJvmArgs

@Incubating public void setJvmArgs(Collection<String> jvmArgs)
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=...`

Since:
  4.3

### isShowProgress

@Incubating public boolean isShowProgress()
Indicates whether analysis progress should be rendered on standard output. Defaults to false.

Since:
  4.2

### setShowProgress

@Incubating public void setShowProgress(boolean showProgress)
Indicates whether analysis progress should be rendered on standard output.

Since:
  4.2