Skip to content

Commit 71825b0

Browse files
committed
Add PMD settings
1 parent 816a234 commit 71825b0

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

app/quality.gradle

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: 'checkstyle'
2+
apply plugin: 'pmd'
23

3-
check.dependsOn 'checkstyle'
4+
check.dependsOn 'checkstyle', 'pmd'
45

56
checkstyle {
67
toolVersion = '7.5.1'
@@ -17,7 +18,28 @@ task checkstyle(type: Checkstyle) {
1718
reports {
1819
html {
1920
enabled true
20-
destination "$project.buildDir/reports/checkstyle/checkstyle.html"
21+
destination "${project.buildDir}/reports/checkstyle/checkstyle.html"
22+
}
23+
}
24+
}
25+
26+
task pmd(type: Pmd) {
27+
ignoreFailures = true
28+
ruleSetFiles = files("${project.rootDir}/ruleset.xml")
29+
ruleSets = []
30+
31+
source 'src'
32+
include '**/*.java'
33+
exclude '**/gen/**'
34+
35+
reports {
36+
xml.enabled = false
37+
html.enabled = true
38+
xml {
39+
destination "${project.buildDir}/reports/pmd/pmd.xml"
40+
}
41+
html {
42+
destination "${project.buildDir}/reports/pmd/pmd.html"
2143
}
2244
}
2345
}

ruleset.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Commons Android App Rules"
3+
xmlns="http://pmd.sf.net/ruleset/1.0.0"
4+
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
5+
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
6+
7+
<description>Custom ruleset for Commons Android app</description>
8+
9+
<exclude-pattern>.*/R.java</exclude-pattern>
10+
<exclude-pattern>.*/gen/.*</exclude-pattern>
11+
12+
<rule ref="rulesets/java/android.xml" />
13+
<rule ref="rulesets/java/basic.xml" />
14+
</ruleset>

0 commit comments

Comments
 (0)