-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquality.gradle
122 lines (97 loc) · 2.45 KB
/
quality.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
repositories {
jcenter()
}
configurations {
detekt
}
apply plugin: 'findbugs'
apply plugin: 'pmd'
def configDir = "${project.rootDir}/settings"
def reportsDir = "${project.buildDir}/reports"
task findbugs(type: FindBugs, dependsOn: "assembleDebug") {
group = "Quality"
ignoreFailures = false
effort = "max"
reportLevel = "high"
excludeFilter = new File("$configDir/findbugs/findbugs-filter.xml")
classes = files("${project.buildDir}/intermediates/classes")
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = true
html.enabled = false
xml {
destination "$reportsDir/findbugs/findbugs.xml"
}
html {
destination "$reportsDir/findbugs/findbugs.html"
}
}
classpath = files()
}
task pmd(type: Pmd) {
group = "Quality"
ignoreFailures = false
ruleSetFiles = files("$configDir/pmd/pmd-ruleset.xml")
ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = true
html.enabled = true
xml {
destination "$reportsDir/pmd/pmd.xml"
}
html {
destination "$reportsDir/pmd/pmd.html"
}
}
}
android {
lintOptions {
abortOnError false
warningsAsErrors true
xmlReport true
htmlReport true
lintConfig file("$configDir/lint/lint.xml")
htmlOutput file("$reportsDir/lint/lint-results.html")
xmlOutput file("$reportsDir/lint/lint-results.xml")
}
}
task ktlint(type: Exec) {
executable = 'ktlint'
args = ['src/**/*.kt']
}
task detekt(type: JavaExec) {
group = "Quality"
main = "io.gitlab.arturbosch.detekt.cli.Main"
classpath = configurations.detekt
def input = "$projectDir"
def config = "$configDir/detekt/config.yml"
def filters = ".*test.*;.*androidTest.*"
def output = "$reportsDir/detekt"
def params = ['-i', input, '-c', config, '-f', filters, '-o', output]
args(params)
}
task checkApp {
group = "Quality"
dependsOn ':app:findbugs'
dependsOn ':app:pmd'
dependsOn ':app:ktlint'
}
task checkLibrary {
group = "Quality"
dependsOn ':library:findbugs'
dependsOn ':library:pmd'
dependsOn ':library:lint'
}
task checkAll {
group = "Quality"
dependsOn 'checkApp'
dependsOn 'checkLibrary'
}
dependencies {
detekt 'io.gitlab.arturbosch.detekt:detekt-cli:1.0.0.RC3'
}