pmd / pmd/pmd

[doc] Improve documentation for Suppression

Open
#893 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in:documentation
Dominant language
Java
Stars
5.5k
Forks
1.6k
Avg merge
1d 19h
Merged PRs (30d)
54

Description

Part of #1139

  • Some formulations in the first section are confusing
  • State clearly which languages support // NOPMD suppressions
  • Provide a better index for suppression alternatives by language?
    I guess people say "how do I suppress this in Java" rather than
    "let's see if I can suppress this with an annotation…"
  • At least cross-link with CPD Suppressions section, as people may look for it here.

Original request:

Affects PMD Version:
6.0.1

Rule:
Documenation. No specific rule.

Description:
The use of Violation Suppress Regex and Violation Suppress XPath needs better examples.

For the regex, it's not clear which message has to be matched (html?, xml?, what delimits "a" message?).

For XPath, a tutorial of how to use the "designer" would be great, plus a few real live examples that show how to find the right XPath expression for a specific rule.

And an explanation where in the AST the rule will match, so that one knows where a construct like ".[typeof(...)]" matches.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the current Suppression documentation and the linked CPD Suppressions section first. Clarify the wording, document which languages support // NOPMD, organize suppression alternatives by language, and add understandable regex and XPath examples, including guidance for the designer. Done means the documentation addresses the listed confusion and provides the requested cross-link and examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.