Disclaimer: FindBugs is completely removed as of Gradle 6.0 and replaced by SpotBugs
. FindBugs support in Static Analysis Plugin is now deprecated and will be removed in the next major version.
Findbugs is a static analysis tool that looks for potential bugs in Java code. It does not support Kotlin. It can be used in both pure Java, and Android Java projects. It then only makes sense to have Findbugs enabled if you have Java code in your project. The plugin only runs Findbugs on projects that contain the Java or the Android plugin.
Enabling and configuring Findbugs for a project is done through the findbugs
closure:
findbugs {
toolVersion // A string, most likely '3.0.1' — the latest Findbugs release (for a long time)
exclude // A fileTree, such as project.fileTree('src/test/java') to exclude Java unit tests
excludeFilter // A file containing the Findbugs exclusions, e.g., teamPropsFile('static-analysis/findbugs-excludes.xml')
htmlReportEnabled true // Control whether html report generation should be enabled. `true` by default.
includeVariants { variant -> ... } // A closure to determine which variants (for Android) to include
}
(assuming you're using the Novoda scaffolding system, see Example configurations for more details)
You can have multiple exclude
statements.
For more informations about Findbugs rules, refer to the official website.
If your project mixes Java and Kotlin code, your Kotlin source files will automatically be ignored.