GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [apex] @SuppressWarnings - allow whitespace around comma when suppressing multiple rules · Issue #5935 · pmd/pmd

[apex] @SuppressWarnings - allow whitespace around comma when suppressing multiple rules #5935

New issue
Copy link
New issue
Copy link
Closed
#6074
Closed
[apex] @SuppressWarnings - allow whitespace around comma when suppressing multiple rules#5935
#6074
Copy link
Labels
a:bugPMD crashes or fails to analyse a file.
Milestone
7.18.0

Description

@AndrewStopchenko-SO
AndrewStopchenko-SO
opened on Jul 24, 2025
Issue body actions

Is your feature request related to a problem? Please describe.
To suppress multiple PMD rules in Apex using @SuppressWarnings('...') annotation, we can put in their ruleNames separated by comma.
However, the tool currently does not allow adding whitespaces before/after commas:

@SuppressWarnings('PMD.ApexDoc,PMD.EmptyCatchBlock') // valid: both ApexDoc and EmptyCatchBlock rules are suppressed.
. . .

@SuppressWarnings('PMD.ApexDoc, PMD.EmptyCatchBlock') // invalid: only ApexDoc is suppressed; EmptyCatchBlock rule is not suppressed.
. . .

Describe the solution you'd like
Adding whitespaces before/after suppressed ruleName (e.g. for readability) should not prevent their detection.

Describe alternatives you've considered

  1. List all suppressed ruleNames "glued together" (no whitespaces).
  2. Add multiple @SuppressWarnings('<ruleName>') annotations to explicitly suppress rules one-by-one.

Additional context
I guess it is caused by this ApexAnnotationSuppressor's code - suppression string value is getting split by comma, but the splitted part is not trimmed before processing.

Running PMD via: Apex PMD VSCode extension.

Activity

  1. AndrewStopchenko-SO
    added
    an:enhancementAn improvement on existing features / rules
    on Jul 24, 2025
  2. stephen-carter-at-sf commented on Aug 25, 2025

    @stephen-carter-at-sf
    stephen-carter-at-sf
    on Aug 25, 2025
    More actions

    @adangel Can we increase the priority of this issue and get it resolved this month?

    We are getting Salesforce Code Analyzer users complaining. Note that we point users to this documentation page: https://docs.pmd-code.org/pmd-doc-7.16.0/pmd_userdocs_suppressing_warnings.html

    which shows the space:

    Image

    So this is clearly a bug.

    Did something change here because historically I believe this must have worked because our source code for the Code Analyzer VS Code Extension separates things with ', ' as shown here: https://github.com/forcedotcom/sfdx-code-analyzer-vscode/blob/dev/src/lib/pmd/pmd-suppressions-code-action-provider.ts#L93

    Reacted by James Simone
  3. jsotuyod
    added
    a:bugPMD crashes or fails to analyse a file.
    and removed
    an:enhancementAn improvement on existing features / rules
    on Aug 25, 2025
  4. jsotuyod commented on Aug 25, 2025

    @jsotuyod
    jsotuyod
    on Aug 25, 2025
    Member
    More actions

    I confirm, this was broken in 7.14.0 through #5609

    The fix should be easy, by trimming part on this line https://github.com/pmd/pmd/blob/main/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ApexAnnotationSuppressor.java#L44

    A test is definitely missing.

    I'm unable to tackle this right now, but I'll do it once I can if no one beats me to it.

    Reacted by Stephen Carter
  5. stephen-carter-at-sf commented on Sep 18, 2025

    @stephen-carter-at-sf
    stephen-carter-at-sf
    on Sep 18, 2025
    More actions

    @jsotuyod Can we please get this fixed ASAP. We are receiving more customer complaints about it.

  6. jsotuyod
    added 2 commits that reference this issue on Sep 18, 2025

    Add failing test for pmd#5935

    f7a9771

    Fix pmd#5935

    51826ec
  7. jsotuyod commented on Sep 18, 2025

    @jsotuyod
    jsotuyod
    on Sep 18, 2025
    Member
    More actions

    There it goes #6074

  8. jamessimone commented on Sep 18, 2025

    @jamessimone
    jamessimone
    on Sep 18, 2025
    More actions

    Thanks y'all, much appreciated

  9. adangel
    added this to the 7.18.0 milestone on Sep 19, 2025
  10. adangel
    added 4 commits that reference this issue on Sep 25, 2025

    [doc] Update release notes (pmd#6074, pmd#5935)

    4d67544

    Add failing test for pmd#5935

    7628675

    Fix pmd#5935

    df47037

    [doc] Update release notes (pmd#6074, pmd#5935)

    8c6a993
  11. adangel
    closed this as completedin #6074on Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bugPMD crashes or fails to analyse a file.

    Type

    No type

    Projects

    No projects

      Milestone

      • 7.18.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.