Skip to content

Instantly share code, notes, and snippets.

@easternHong
Last active August 29, 2020 07:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save easternHong/a1a637721529fd001b96 to your computer and use it in GitHub Desktop.
Save easternHong/a1a637721529fd001b96 to your computer and use it in GitHub Desktop.
android studio gradle checkstyle findbugs pmd lint
//go to https://github.com/easternHong/vb-android-app-quality
//get the config file and put them into app/config/..
apply plugin: 'pmd'
apply plugin: 'findbugs'
apply plugin: 'checkstyle'
task findbugs(type: FindBugs) {
description 'Run findbugs'
group 'verification'
classes = fileTree('build/intermediates/classes/debug/')
source = fileTree('src/main/java')
classpath = files()
effort = 'max'
reportLevel = "high"
ignoreFailures = true
excludeFilter = file("config/quality/findbugs/findbugs-filter.xml")
reports {
xml.enabled = false
html.enabled = true
html {
destination "$project.buildDir/reports/findbugs/findbugs-output.html"
}
}
}
task pmd(type: Pmd) {
ignoreFailures = true
ruleSetFiles = files("config/quality/pmd/pmd-ruleset.xml")
ruleSets = []
//source 'src'
source = fileTree('src/main/java')
include '**/*.java'
exclude '**/gen/**'
reports {
//xml.enabled = false
html.enabled = true
// xml {
// destination "$project.buildDir/reports/pmd/pmd.xml"
// }
html {
destination "$project.buildDir/reports/pmd/pmd.html"
}
}
}
task checkstyle(type: Checkstyle) {
ignoreFailures = true
configFile file("config/quality/checkstyle/checkstyle.xml")
configProperties.checkstyleSuppressionsPath = file("config/quality/checkstyle/suppressions.xml").absolutePath
source = fileTree('src/main/java')
include '**/*.java'
exclude '**/gen/**'
classpath = files()
reports {
xml.enabled = true
// html.enabled = true
xml {
destination "$project.buildDir/reports/checkstyle/checkstyle.xml"
}
// html {
// destination "$project.buildDir/reports/checkstyle/checkstyle.html"
// }
}
}
check.doLast {
project.tasks.getByName("findbugs").execute()
project.tasks.getByName("pmd").execute()
project.tasks.getByName("checkstyle").execute()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment