????Gradle?????
?????????????????????????????????Findbugs???????????(??Gradle???????):
????task findbugs(type: FindBugs) {
????ignoreFailures = false
????effort = "max"
????reportLevel = "high"
????excludeFilter = new File("${project.rootDir}/config/quality/findbugs/findbugs-filter.xml")
????classes = files("${project.rootDir}/app/build/classes")
????source 'src'
????include '**/*.java'
????exclude '**/gen/**'
????reports {
????xml.enabled = false
????html.enabled = true
????xml {
????destination "$project.buildDir/reports/findbugs/findbugs.xml"
????}
????html {
????destination "$project.buildDir/reports/findbugs/findbugs.html"
????}
????}
????classpath = files()
????}
?????????????????Checkstyle????????Findbugs???HTML??XML?????????????????HTML????????????????????п??????????????????????λ????????????????????????λ?á?????????????????????Findbgus???????(??????????)????? FindBugs?????????CheckStyle???????????????????“FindBugs”????
????Findbugs????ü???
????????Android??????Java??????в???????????????FindBugs??????(????????)?????????????????????????????????????????????R????????Manifest????????????????(???)FindBugs????????????????????????????????????????????
????PMD
???????
????????????и???????????PMD??????????????????(????)????????????????????????????????:
????Pretty Much Done
????Project Meets Deadline
??????????PMD??????????е?????Findbugs????????????(PMD)??????????????????????(??????PMD???ú??????)?? (PMD??Findbugs)???????????????????????????????????Щ???????bug?????????????Findbugs??PMD????e??????Findbugs??PMD???????????(????)??????鷽?????????????PMD?????????bug????Findbugs???鯔??????????????
????Gradle?????
?????????????????????????????????PMD???????????(??Gradle???????):
????task pmd(type: Pmd) {
????ruleSetFiles = files("${project.rootDir}/config/quality/pmd/pmd-ruleset.xml")
????ignoreFailures = false
????ruleSets = []
????source 'src'
????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"
????}
????}
????}
????PMD?????????????Findbugs?????PMD???HTML??XML????????????????????????HTML?????????????????????????????ü??????????????????????(check this file)?????????????????????????Щ??????ü????????????????PMD???FindBugs??????????????磺?????????”if statement”??”if statement”????????????????????????????Щ??????????????????????????(??????????)?????????????????????????????????????”if statement”????????????????????????????PMD????????(???)CheckStyle???????????????????“PMD”????
????PMD????ü???
?????????????????????????ü??????????????д???(???????)??
????ruleSets = []
???????????????????Щ????????????ü???????????????ü?????????????????С??????????????????????????Щ???????ü??У????????????С?
????Android Lint
???????
????“Android lint?????????????????????????????鰲???????????????????????????????????????????????????????????????”
??????????????????Android Lint??????????????????????Android?????????????????????????????????????????????
????Gradle?????
????android {
????lintOptions {
????abortOnError true
????lintConfig file("${project.rootDir}/config/quality/lint/lint.xml")
????// if true?? generate an HTML report (with issue explanations?? sourcecode?? etc)
????htmlReport true
????// optional path to report (default will be lint-results.html in the builddir)
????htmlOutput file("$project.buildDir/reports/lint/lint.html")
????}
??????????????????????????????????Щ?????????ú????á????????????μ?ADT?汾??????????????á???????????е?lint?????????????Щ????ADT 21????????????”ignore”??”severity”:
????IconDensities??????????????????????????????е?(?????)????????ldpi????
????IconDipSize:????????????????????dip???????????(???仰?????????????????density?????????????????????????????????С)??
????????????????????lint???????????????????й??????Android Lint?????????CheckStyle???????????????????”lint”????
????Android Lint????ü???
????????Android Lint??????????????????μ?Android Lint????????????ù?????????Щ????“ignore”??“severity”?????á??????????????°汾ADT?μ??????ù????????????飬??????????
??????????
????????????????е????????????????????????????????????????????????????????á????????????gradle?????????????????統(tǒng)??????????????????????????????????С??????Gradle?У?????ù??????“check”???????????????????????
????check.dependsOn ‘checkstyle’?? ‘findbugs’?? ‘pmd’?? ‘lint’??????????“check” ????????Checkstyle?? Findbugs?? PMD?? and Android Lint????????С????????/ commiting / pushing / ask merge request ??????????????????????????
??????????????Gradle??????????????????????????????????????е??????????????Gradle??????????????????з??????Щ?????????????????“config/quality” ????????
???????
??????????????У?????Gradle??Android????????????鶴??????????????????????????????????????????????????????Щ????????????????????Jenkins/Hudson???????????????????????????飬????????????????????????CLI????????????? Jenkins/Hudson????У???????У?
????gradle check?????????????·???????????????κ??й?Android??????