3

When looking at PMD documentation it appears that for apex code there is no way to do a suppression for a single line of code. I have a lot of false positives that have been making builds fail so I need to find away around this besides for suppressing the rule for the whole class. Has anyone found a way around this for APEX?

Sammy
  • 33
  • 3

1 Answers1

3

PMD has 3 ways to suppress warnings in Apex:

  1. Using @SuppressWarnings, which works on any element that is annotateable (classes, fields, methods, etc.)
  2. Using violationSuppressRegex
  3. Using violationSuppressXPath

See also: https://pmd.github.io/pmd-6.4.0/pmd_userdocs_suppressing_warnings.html#annotations

Update:

As of PMD 6.22.0, usage of // NOPMD comments is also a possibility.

Johnco
  • 4,037
  • 4
  • 34
  • 43