Created
June 8, 2016 18:56
-
-
Save pedroct92/3cf903970a6d184cc8b353ba990b6b17 to your computer and use it in GitHub Desktop.
Findbugs and PMD with Android Gradle Plugin
This file contains hidden or 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 hidden or 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