-
Notifications
You must be signed in to change notification settings - Fork 0
/
jacoco.gradle
88 lines (82 loc) · 3.18 KB
/
jacoco.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
apply plugin: "jacoco"
jacoco {
toolVersion = "0.8.8"
}
test {
jacoco {
excludes = []
}
finalizedBy jacocoTestCoverageVerification // code coverage is verified after tests run
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled true
csv.enabled false
html.destination file("${rootDir}/reports/code-coverage")
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
/*excluding original osis stub code*/
"**/com/vmware/osis/resource/*.*",
"**/com/vmware/osis/model/**/*.*",
"**/com/vmware/osis/annotation/*.*",
"**/com/vmware/osis/security/**/*.*",
"**/com/vmware/osis/service/*.*",
"**/com/vmware/osis/validation/*.*",
"**/com/vmware/osis/platform/**/*.*",
"**/com/vmware/osis/platform/*.*",
/*Ignore config classes*/
"**/com/scality/osis/configuration/*.*",
"**/com/scality/osis/*.*",
"**/com/scality/osis/security/basic/*.*",
"**/com/scality/osis/security/crypto/model/*.*",
"**/com/scality/osis/security/crypto/CryptoEnv*.*",
"**/com/scality/osis/security/utils/YamlPropertySourceFactory.*",
"**/com/scality/osis/security/utils/SecurityConstants.*",
/*Ignore external library*/
"**/com/scality/osis/security/crypto/Hkdf*.*"
])
}))
}
}
jacocoTestCoverageVerification {
dependsOn jacocoTestReport
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
/*excluding original osis stub code*/
"**/com/vmware/osis/resource/*.*",
"**/com/vmware/osis/model/**/*.*",
"**/com/vmware/osis/annotation/*.*",
"**/com/vmware/osis/security/**/*.*",
"**/com/vmware/osis/service/*.*",
"**/com/vmware/osis/validation/*.*",
"**/com/vmware/osis/platform/**/*.*",
"**/com/vmware/osis/platform/*.*",
/*Ignore config classes*/
"**/com/scality/osis/configuration/*.*",
"**/com/scality/osis/*.*",
"**/com/scality/osis/security/**/*.*",
"**/com/scality/osis/security/crypto/**/*.*",
"**/com/scality/osis/vaultadmin/utils/VaultAdminUtils.*",
/*Ignore external library*/
"**/com/scality/osis/security/crypto/Hkdf.*"
])
}))
}
violationRules {
rule {
limit {
minimum = 0.75 // verifying mandatory code coverage of 75%
}
}
rule {
element = 'METHOD'
excludes = [
]
}
}
}
check.dependsOn('jacocoTestReport')