Skip to content

Commit 97d681f

Browse files
committed
[SPARK-52137] Upgrade pmd to 7.13.0
### What changes were proposed in this pull request? This PR aims to upgrade `pmd` from `6.55.0` to `7.13.0`. ### Why are the changes needed? We had better upgrade to prevent the future regressions because there are many improvements in PMD 7.x. - https://pmd.github.io/2024/03/22/PMD-7-is-here/ ### Does this PR introduce _any_ user-facing change? No behavior change. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#200 from dongjoon-hyun/SPARK-52137. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 058bc7e commit 97d681f

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

build-tools/docs-utils/src/main/java/org/apache/spark/k8s/operator/utils/DocTable.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ public void flush(PrintWriter writer) {
5757
private String joinRow(List<String> elements) {
5858
StringBuilder stringBuilder = new StringBuilder(ROW_SEPARATOR);
5959
for (String element : elements) {
60-
stringBuilder.append(element);
61-
stringBuilder.append(ROW_SEPARATOR);
60+
stringBuilder.append(element).append(ROW_SEPARATOR);
6261
}
6362
if (elements.size() < columns) {
6463
// Append empty cells to end if needed

config/pmd/ruleset.xml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
Apache Spark Kubernetes Operator Ruleset
2323
</description>
2424
<rule ref="category/java/bestpractices.xml">
25-
<exclude name="JUnitAssertionsShouldIncludeMessage" />
26-
<exclude name="JUnitTestContainsTooManyAsserts" />
25+
<exclude name="GuardLogStatement" />
26+
<exclude name="ImplicitFunctionalInterface" />
27+
<exclude name="UnitTestAssertionsShouldIncludeMessage" />
28+
<exclude name="UnitTestContainsTooManyAsserts" />
29+
<exclude name="UnitTestShouldIncludeAssert" />
30+
<exclude name="UnusedLocalVariable" />
31+
<exclude name="LooseCoupling" />
2732
</rule>
2833
<rule ref="category/java/codestyle.xml">
2934
<exclude name="AtLeastOneConstructor" />
@@ -36,16 +41,24 @@
3641
<exclude name="OnlyOneReturn" />
3742
<exclude name="ShortVariable" />
3843
<exclude name="TooManyStaticImports" />
44+
<exclude name="UnnecessaryCast" />
45+
<exclude name="UnnecessaryFullyQualifiedName" />
46+
<exclude name="UseExplicitTypes" />
3947
<exclude name="UseUnderscoresInNumericLiterals" />
4048
</rule>
4149
<rule ref="category/java/design.xml">
4250
<exclude name="AbstractClassWithoutAnyMethod" />
4351
<exclude name="AvoidCatchingGenericException" />
52+
<exclude name="ClassWithOnlyPrivateConstructorsShouldBeFinal" />
4453
<exclude name="CognitiveComplexity" />
54+
<exclude name="CouplingBetweenObjects" />
4555
<exclude name="CyclomaticComplexity" />
56+
<exclude name="DataClass" />
4657
<exclude name="ExcessiveImports" />
58+
<exclude name="FinalFieldCouldBeStatic" />
4759
<exclude name="LawOfDemeter" />
4860
<exclude name="NPathComplexity" />
61+
<exclude name="SimplifyBooleanReturns" />
4962
<exclude name="TooManyMethods" />
5063
</rule>
5164
<rule ref="category/java/documentation.xml">
@@ -67,13 +80,15 @@
6780
<exclude name="UseProperClassLoader" />
6881
</rule>
6982
<rule ref="category/java/multithreading.xml">
83+
<exclude name="AvoidSynchronizedStatement" />
7084
<exclude name="DoNotUseThreads" />
7185
<exclude name="UseConcurrentHashMap" />
7286
</rule>
7387
<rule ref="category/java/performance.xml">
7488
<exclude name="AvoidFileStream" />
7589
<exclude name="AvoidInstantiatingObjectsInLoops" />
7690
<exclude name="RedundantFieldInitializer" />
91+
<exclude name="UseArraysAsList" />
7792
</rule>
7893
<rule ref="category/java/security.xml"/>
7994
<!-- exclude on generated files -->

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mockito = "5.17.0"
3030

3131
# Build Analysis
3232
checkstyle = "10.23.1"
33-
pmd = "6.55.0"
33+
pmd = "7.13.0"
3434
spotbugs-tool = "4.8.6"
3535
spotbugs-plugin = "6.0.17"
3636
spotless-plugin = "6.25.0"

0 commit comments

Comments
 (0)