-
Notifications
You must be signed in to change notification settings - Fork 49
/
code-quality.gradle
91 lines (80 loc) · 2.55 KB
/
code-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
//this build file is responsible for all the configuration of code quality items, such as code coverage, syntax style checking, static bug finding, etc.
apply plugin: "jacoco"
apply plugin: "pmd"
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration/java')
}
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
task integrationTest(type: Test, dependsOn: "cloneConformanceSuite") {
group "Verification"
description "Runs the integration tests."
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
testLogging.showStandardStreams = true
}
jacocoTestReport.dependsOn integrationTest //include the integration tests in the code coverage reports
jacocoTestReport.dependsOn test //ensure the tests have run before generating a coverage report
check.dependsOn integrationTest //run the integration tests
check.dependsOn jacocoTestReport //run the code coverage reports
check.dependsOn javadoc //ensure javadocs are generated correctly
//ignore some of the code quality checks for tests since you can't always follow the best practices when testing
spotbugsIntegrationTest.enabled = false
spotbugsTest.enabled = false
pmdIntegrationTest.enabled = false
pmdTest.enabled = false
pmd {
toolVersion = "5.5.4"
ruleSets = [
"java-basic",
"java-braces",
"java-clone",
"java-codesize",
"java-design",
"java-empty",
"java-finalizers",
"java-imports",
"java-j2ee",
"java-javabeans",
"java-optimizations",
"java-strictexception",
"java-strings",
"java-sunsecure",
"java-typeresolution",
"java-unnecessary",
"java-unusedcode"
]
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['gov.loc.repository.bagit/domain/**',
'gov.loc.repository.bagit/annotation/**',
'gov.loc.repository.bagit/exceptions/**'])
})
}
}
cpdCheck {
source = sourceSets.main.allJava
reports {
text.enabled = true
xml.enabled = false
}
}
dependencyCheck {
skipTestGroups=true
skipConfigurations=['spotbugs','cpd'] //don't look for vulnerabilities in the build plugins
outputDirectory="build/reports/OWASP"
}