chore: exclude PMD InvalidLogMessageFormat (SLF4J trailing-Throwable convention)#1334
chore: exclude PMD InvalidLogMessageFormat (SLF4J trailing-Throwable convention)#1334joaodinissf wants to merge 1 commit into
Conversation
…ling-Throwable convention)
PMD's InvalidLogMessageFormat rule flags the SLF4J idiom `LOGGER.x("...{}...", arg, throwable)` as having an argument-count mismatch (1 placeholder vs 2 args). Per SLF4J's FAQ (https://www.slf4j.org/faq.html#paramException) this is the documented and intended way to log a parameterized message together with an exception — SLF4J trims the trailing Throwable, uses the remaining args for placeholders, and attaches the Throwable to the log event for stack-trace rendering.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66eeb1a to
60b5d93
Compare
rubenporras
left a comment
There was a problem hiding this comment.
This does not make much sense, according to the documentation PMD LOGGER.x("...{}...", arg, throwable) is correct: https://pmd.github.io/pmd/pmd_rules_java_errorprone.html
Is there a particular code where PMD is failing?
|
(Comment left by Claude at João's request.) You were right — the PMD docs are accurate. Closing this in favour of the real fix in #1333. The root cause was that our CI invoked Fix in #1333: every analysis step now runs |
PMD's
InvalidLogMessageFormatrule flags the SLF4J idiomLOGGER.x("...{}...", arg, throwable)as an argument-count mismatch (1 placeholder vs 2 args). Per SLF4J's FAQ this is the documented and intended way to log a parameterized message together with an exception — SLF4J trims the trailingThrowable, uses the remaining args for placeholders, and attaches theThrowableto the log event for stack-trace rendering. Excluding the rule inddk-configuration/pmd/ruleset.xmlremoves the per-site// NOPMDnoise that would otherwise be needed.🤖 Generated with Claude Code