Created
December 19, 2015 07:04
-
-
Save abruzzi/169fe44dbfbd8536cf37 to your computer and use it in GitHub Desktop.
Findbugs and PMD with Android Gradle Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Thanks to https://github.com/stephanenicolas/Quality-Tools-for-Android/blob/master/build.gradle | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.7.+' | |
} | |
} | |
apply plugin: 'android' | |
apply plugin: 'findbugs' | |
apply plugin: 'pmd' | |
android { | |
//Configuration | |
} | |
task findbugs (type: FindBugs, dependsOn: assembleDebug) { | |
description 'Run findbugs' | |
group 'verification' | |
classes = fileTree('build/classes/debug/') | |
source = fileTree('src/main/java') | |
classpath = files(project.configurations.compile.asPath) | |
effort = 'max' | |
excludeFilter = file("./config/findbugs/exclude.xml") | |
reports { | |
xml.enabled = false | |
html.enabled = true | |
} | |
} | |
task pmd (type: Pmd, dependsOn: assembleDebug) { | |
description 'Run pmd' | |
group 'verification' | |
ruleSets = ["basic", "braces", "strings", "design", "unusedcode"] | |
source = fileTree('src/main/java') | |
reports { | |
xml.enabled = false | |
html.enabled = true | |
} | |
} | |
check.doLast { | |
project.tasks.getByName("findbugs").execute() | |
project.tasks.getByName("pmd").execute() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<FindBugsFilter> | |
<Match> | |
<Class name="~.*R\$.*"/> | |
</Match> | |
<Match> | |
<Class name="~.*Manifest\$.*"/> | |
</Match> | |
</FindBugsFilter> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment