Skip to content

Commit 032addc

Browse files
committed
Configure custom PMD ruleset
1 parent 3378187 commit 032addc

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

buildSrc/src/main/groovy/com.craftsmanshipinsoftware.common-conventions.gradle

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ testing {
2424
pmd {
2525
consoleOutput = true
2626
toolVersion = libs.versions.pmd.get()
27-
ruleSets = ["category/java/errorprone.xml",
28-
"category/java/bestpractices.xml",
29-
"category/java/performance.xml"]
27+
ruleSets = []
28+
ruleSetFiles = files(file("${rootProject.projectDir}/config/pmd/ruleset.xml"))
3029
}

config/pmd/ruleset.xml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
3+
<ruleset name="Custom Rules"
4+
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
7+
8+
<description>
9+
Exercises for Programmers - custom rules
10+
</description>
11+
12+
<rule ref="category/java/errorprone.xml"/>
13+
<rule ref="category/java/bestpractices.xml">
14+
<exclude name="JUnitTestsShouldIncludeAssert"/>
15+
<exclude name="JUnitTestContainsTooManyAsserts"/>
16+
</rule>
17+
<rule ref="category/java/performance.xml"/>
18+
19+
</ruleset>

0 commit comments

Comments
 (0)