This is an automated email from the ASF dual-hosted git repository.

dongjoon-hyun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-kubernetes-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new ee106cb3 [SPARK-60014] Upgrade PMD to 7.28.0
ee106cb3 is described below

commit ee106cb339c4187b9ab53a90f59331717af04f77
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Tue Oct 6 21:27:37 2026 -0700

    [SPARK-60014] Upgrade PMD to 7.28.0
    
    ### What changes were proposed in this pull request?
    
    This PR aims to upgrade PMD from 7.27.0 to 7.28.0.
    
    Since the ruleset references whole rule categories, the rules added or 
changed in 7.28.0 apply automatically and reported 15 violations.
    - `OnDemandImport` (new in 7.28.0, 14 violations) is excluded because this 
project allows wildcard imports, like Checkstyle (no `AvoidStarImport`) and the 
already excluded `TooManyStaticImports` rule.
    - `SimplifyConditional` is fixed in place: 
`PrometheusPullModelHandler.formatGauge` moves the `instanceof Number` check 
forward and removes the redundant null check.
    
    ### Why are the changes needed?
    
    To use the latest PMD release, which includes new Java rules and bug fixes.
    
    - https://github.com/pmd/pmd/releases/tag/pmd_releases%2F7.28.0 (2026-09-25)
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Pass the CIs.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Opus 5.5
    
    Closes #942 from dongjoon-hyun/SPARK-60014.
    
    Authored-by: Dongjoon Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 config/pmd/ruleset.xml                             |  1 +
 gradle/libs.versions.toml                          |  2 +-
 gradle/verification-metadata.xml                   | 36 +++++++++++-----------
 .../metrics/PrometheusPullModelHandler.java        |  5 ++-
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/config/pmd/ruleset.xml b/config/pmd/ruleset.xml
index 0d88f1a3..391a0d72 100644
--- a/config/pmd/ruleset.xml
+++ b/config/pmd/ruleset.xml
@@ -27,6 +27,7 @@
     <exclude name="UnitTestAssertionsShouldIncludeMessage" />
     <exclude name="UnitTestContainsTooManyAsserts" />
     <exclude name="LooseCoupling" />
+    <exclude name="OnDemandImport" />
   </rule>
   <rule ref="category/java/codestyle.xml">
     <exclude name="AtLeastOneConstructor" />
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 01b670d6..c36b7c45 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -36,7 +36,7 @@ awaitility = "4.3.0"
 
 # Build Analysis
 checkstyle = "13.4.2"
-pmd = "7.27.0"
+pmd = "7.28.0"
 spotbugs-tool = "4.10.4"
 spotbugs-plugin = "6.5.12"
 spotless-plugin = "8.10.1"
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index ff44a670..3eaf34a0 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -1747,33 +1747,33 @@
             <sha512 
value="31fdb8a09f9ebaf13eed63456c8969365fb8e34e3ac84ede94972d495ea2dabfd44c94b4d22948e5b5b9fca6086f7d8afdba6466a3d9b80a3adb290a1235b42b"
 origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="net.sourceforge.pmd" name="pmd" version="7.27.0">
-         <artifact name="pmd-7.27.0.pom">
-            <sha512 
value="48f9d9d29e8e20d762b42c12a1cffecd5623aa610a33115cfdbfba116eabf832a9a24d1c1f1d60abf1c1c4156d0e5d740bb2191f41028649f03b289cae7306b8"
 origin="Generated by Gradle"/>
+      <component group="net.sourceforge.pmd" name="pmd" version="7.28.0">
+         <artifact name="pmd-7.28.0.pom">
+            <sha512 
value="bed02b3f022355187ad48e26ee9e8379142983e607751f7f283fc5906433085376c730cfc98c83320effd26a8c11228b5fb02cf0bd2c1b35ff3bd245235e624d"
 origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="net.sourceforge.pmd" name="pmd-ant" version="7.27.0">
-         <artifact name="pmd-ant-7.27.0.jar">
-            <sha512 
value="1900ef36f3acc95b1277740164407d3f33357e495088cb259ce50870218717e485974e4afa924d003ceaca97da2974eea6b20d53cfec04ad8e44f56b4a1e135a"
 origin="Generated by Gradle"/>
+      <component group="net.sourceforge.pmd" name="pmd-ant" version="7.28.0">
+         <artifact name="pmd-ant-7.28.0.jar">
+            <sha512 
value="02e2b4439873bc940064032866583531ad819ff9a18b9bd9534e0974ecb60860cdbf606749eb0a3a438655e2e0b33ef385446a7cacb5dfc6cd85f1d7c48ad86c"
 origin="Generated by Gradle"/>
          </artifact>
-         <artifact name="pmd-ant-7.27.0.pom">
-            <sha512 
value="a184d988143a9bfea9def486a01657119b8ba95f905edbf491ff256356f773efbc5758ce49182bef29ff77f4c55c85fb2d7f536993332be3c8a551c5717b8948"
 origin="Generated by Gradle"/>
+         <artifact name="pmd-ant-7.28.0.pom">
+            <sha512 
value="85c77026fb9c74f666b29f2208485bf3938713e8c9fe373cd6359e1726b0d8c1f7e4ae575e890705a04173287dac09536b1656c5b9367e0952a7ec39f2603b30"
 origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="net.sourceforge.pmd" name="pmd-core" version="7.27.0">
-         <artifact name="pmd-core-7.27.0.jar">
-            <sha512 
value="0fa19a90846e9abbf9b0c6f20309105aea3cf167fdf4d30a284da8a140f0118a0eebae758b26e93a4254f112b30ce2a1b0652019f6130a01dc69366b624cf266"
 origin="Generated by Gradle"/>
+      <component group="net.sourceforge.pmd" name="pmd-core" version="7.28.0">
+         <artifact name="pmd-core-7.28.0.jar">
+            <sha512 
value="eee988b0dc484c7706fdc648d52e25823ab981eecb921cf41269ba545fa910f6a1d619cf6f2a8d06a80a0e0d5f4d0e9658b9f271f8088a2b32a51d604ab66a2b"
 origin="Generated by Gradle"/>
          </artifact>
-         <artifact name="pmd-core-7.27.0.pom">
-            <sha512 
value="6c14ea0881d02e35b75700500c06bfb176c220babe85dc1da85a18103c4a8990a3280e5e74d405f6207342d2e743dd1a90a32524314a82545fe8d2df54aad188"
 origin="Generated by Gradle"/>
+         <artifact name="pmd-core-7.28.0.pom">
+            <sha512 
value="a8444dfe7c15dd4afb1dd3e72d2be5d63c6e9e119ca39b9eccb3d6ccc02443aa7c1790e96d64cb8cdf4a263868d362a77a70c579dd8fce2792061ade4bb25986"
 origin="Generated by Gradle"/>
          </artifact>
       </component>
-      <component group="net.sourceforge.pmd" name="pmd-java" version="7.27.0">
-         <artifact name="pmd-java-7.27.0.jar">
-            <sha512 
value="ab762d3186e22ecdb2dbe5752d9c69fe67cebdf14ab23a229d2ab252ee0ae9a179e4a2f82f25381e77b24104ff25dfe4d62b695a86b9b19ab293d74f23f22cc7"
 origin="Generated by Gradle"/>
+      <component group="net.sourceforge.pmd" name="pmd-java" version="7.28.0">
+         <artifact name="pmd-java-7.28.0.jar">
+            <sha512 
value="1ed7c16c10be02dcfe2e6b0acdea2570dd60940fd8cdee96da04015711179d12f1e2844c544b0304839a4b6918e94e402267f4bd90a4a690eed065c4a4688c7c"
 origin="Generated by Gradle"/>
          </artifact>
-         <artifact name="pmd-java-7.27.0.pom">
-            <sha512 
value="378069341c5b272575f3f47f9ff9b48a803167b1db8a475ea3e19d73acda97b33e03929f61d02c4c0688a37b29fc77b0a0160d081dd48862066d103966a01027"
 origin="Generated by Gradle"/>
+         <artifact name="pmd-java-7.28.0.pom">
+            <sha512 
value="e130caf372a168687885fd4e72a6002c1f122c9f5495ce99dc6d38d67b59fdf0d1f96bfdbadf8c464d072fd7e8b272f22c41230e8a8f70a33e6cd384e9fd2cd4"
 origin="Generated by Gradle"/>
          </artifact>
       </component>
       <component group="org.antlr" name="antlr4-master" version="4.13.2">
diff --git 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/PrometheusPullModelHandler.java
 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/PrometheusPullModelHandler.java
index 06e980d1..85b8d9c8 100644
--- 
a/spark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/PrometheusPullModelHandler.java
+++ 
b/spark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/PrometheusPullModelHandler.java
@@ -189,9 +189,8 @@ public class PrometheusPullModelHandler extends 
PrometheusServlet implements Htt
    */
   protected String formatGauge(String name, Gauge gauge) {
     if (gauge != null
-        && gauge.getValue() != null
-        && !EMPTY_RECORD_VALUE.equals(gauge.getValue())
-        && gauge.getValue() instanceof Number) {
+        && gauge.getValue() instanceof Number
+        && !EMPTY_RECORD_VALUE.equals(gauge.getValue())) {
       String formattedName = sanitize(name);
       return "# HELP "
           + formattedName


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to