FindBugs snippet
...
apply plugin: 'findbugs'
...
task findbugs(type: FindBugs, dependsOn: assembleDebug) {
excludeFilter file("${project.rootDir}/config/findbugs/exclude.xml")
classes = fileTree('build/intermediates/classes/debug/') // Varies based on your app build configs and flavors...
source = fileTree('src/main/java/')
classpath = files()
effort = 'max'
reports {
xml.enabled = false
html.enabled = true
}
}
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
<!-- http://stackoverflow.com/questions/7568579/eclipsefindbugs-exclude-filter-files-doesnt-work -->
<Match>
<Class name="~.*\.R\$.*"/>
</Match>
<Match>
<Class name="~.*\.Manifest\$.*"/>
</Match>
<!-- All bugs in test classes, except for JUnit-specific bugs -->
<Match>
<Class name="~.*\.*Test" />
<Not>
<Bug code="IJU" />
</Not>
</Match>
</FindBugsFilter>
./gradlew app:findbugs