aboutsummaryrefslogtreecommitdiff
path: root/gradle/pmd.gradle
blob: aaaff0264aaf92ba73296aab9ece0df8770f02d4 (plain)
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
apply plugin: 'pmd'

pmd {
    toolVersion = '6.17.0'
}

tasks.register("pmdMain", Pmd) { task ->
    task.dependsOn tasks.named("assembleDebug")
    task.description 'Identifying potential problems mainly dead code, duplicated code, cyclomatic complexity and overcomplicated expressions'
    task.group 'verification'
    task.rulePriority = 2
    task.source = fileTree('src/main/java')
    task.include '**/*.java'
    task.exclude '**/gen/**'

    task.reports {
        xml.enabled = false
        html.enabled = true
        html.destination = task.project.file("$project.buildDir/outputs/pmd/pmd.html")
    }
}

tasks.register("pmdTest", Pmd) { task ->
    task.dependsOn tasks.named("assembleDebugUnitTest")
    task.description 'Identifying potential problems mainly dead code, duplicated code, cyclomatic complexity and overcomplicated expressions'
    task.group 'verification'
    task.rulePriority = 2
    task.source = fileTree('src/test/java')
    task.include '**/*.java'
    task.exclude '**/gen/**'

    task.reports {
        xml.enabled = false
        html.enabled = true
        html.destination = task.project.file("$project.buildDir/outputs/pmd/pmd-test.html")
    }
}