Skip to content

Commit cfd5063

Browse files
committed
[SPARK-53628] Upgrade PMD/SpotBugs and enable checking on Java 25
### What changes were proposed in this pull request? This PR aims to upgrade `pmd` and `spotbugs` test dependency and enable it on Java 25. ### Why are the changes needed? Previously, `PMD` and `SpotBugs` check are enabled only on Java 17 and 21. ### Does this PR introduce _any_ user-facing change? No behavior change because this is a code quality check during building. ### How was this patch tested? Pass the CIs. Java 25 test pipeline will cover this. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#322 from dongjoon-hyun/SPARK-53628. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 39a5ba7 commit cfd5063

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

build.gradle

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,22 @@ subprojects {
7171
showViolations = true
7272
}
7373

74-
if (JavaVersion.current() < JavaVersion.VERSION_25) {
75-
apply plugin: 'pmd'
76-
pmd {
77-
ruleSetFiles = files("$rootDir/config/pmd/ruleset.xml")
78-
toolVersion = libs.versions.pmd.get()
79-
consoleOutput = true
80-
ignoreFailures = false
81-
}
74+
apply plugin: 'pmd'
75+
pmd {
76+
ruleSetFiles = files("$rootDir/config/pmd/ruleset.xml")
77+
toolVersion = libs.versions.pmd.get()
78+
consoleOutput = true
79+
ignoreFailures = false
80+
}
8281

83-
apply plugin: 'com.github.spotbugs'
84-
spotbugs {
85-
toolVersion = libs.versions.spotbugs.tool.get()
86-
afterEvaluate {
87-
reportsDir = file("${project.reporting.baseDirectory}/findbugs")
88-
}
89-
excludeFilter = file("$rootDir/config/spotbugs/spotbugs_exclude.xml")
90-
ignoreFailures = false
82+
apply plugin: 'com.github.spotbugs'
83+
spotbugs {
84+
toolVersion = libs.versions.spotbugs.tool.get()
85+
afterEvaluate {
86+
reportsDir = file("${project.reporting.baseDirectory}/findbugs")
9187
}
88+
excludeFilter = file("$rootDir/config/spotbugs/spotbugs_exclude.xml")
89+
ignoreFailures = false
9290
}
9391

9492
apply plugin: 'jacoco'

config/pmd/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<exclude name="TooManyStaticImports" />
4242
<exclude name="UseExplicitTypes" />
4343
<exclude name="UseUnderscoresInNumericLiterals" />
44+
<exclude name="TypeParameterNamingConventions" />
4445
</rule>
4546
<rule ref="category/java/design.xml">
4647
<exclude name="AbstractClassWithoutAnyMethod" />

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ mockito = "5.18.0"
3030

3131
# Build Analysis
3232
checkstyle = "10.23.1"
33-
pmd = "7.13.0"
34-
spotbugs-tool = "4.9.3"
35-
spotbugs-plugin = "6.1.13"
33+
pmd = "7.17.0"
34+
spotbugs-tool = "4.9.6"
35+
spotbugs-plugin = "6.4.2"
3636
spotless-plugin = "6.25.0"
3737

3838
# Packaging

spark-operator/src/test/java/org/apache/spark/k8s/operator/probe/ReadinessProbeTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
import org.apache.spark.k8s.operator.utils.ProbeUtil;
3939

40-
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
4140
class ReadinessProbeTest {
4241
KubernetesClient client;
4342
HttpExchange httpExchange;

spark-operator/src/test/java/org/apache/spark/k8s/operator/utils/StatusRecorderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ void retriesFailedStatusPatches() {
8686
any());
8787
}
8888

89-
private static @NotNull SparkApplication getSparkApplication(String resourceVersion) {
89+
@NotNull
90+
private static SparkApplication getSparkApplication(String resourceVersion) {
9091
var updated = TestUtils.createMockApp(DEFAULT_NS);
9192
updated.getMetadata().setResourceVersion(resourceVersion);
9293
return updated;

0 commit comments

Comments
 (0)