The PMD bundled plugin scans Java source code and other languages, and looks for potential problems such as bugs, dead code, suboptimal code, overcomplicated expressions, and duplicate code. Use the plugin in your code review process to find common programming flaws.
PMD is configurable and can find many different issues.
The PMD libraries are embedded in the plugin, so there are no external tools to install. Because PMD operates on source code files, add the PMD plugin to a chain that populates a workspace.
To configure the PMD step:
Add the PMD step to a chain, as described in Create chains.
Enter the plugin configuration details:
Field Description Title Enter a name for the plugin step or accept the default name. Source folder
Enter the relative stream directory against which to run the analysis, for example:
Command-line option (should be a relative path):
Select a ruleset location:
- Use built-in rulesets (default).
- Use local rulesets.
- Use rulesets stored in the stream.
Enter a comma-separated list of ruleset names, for example:
In addition to standard rulesets, you can use a custom ruleset.
(Optional) Specify the classpath for libraries used by the source code, for example:
(Optional) Specify the source code encoding, for example, UTF-8.
(Optional) Specify the source code language, for example, Java.
(Optional) Specify the version of the source code language.
(Optional) Select to show suppressed findings.
(Optional) Specify the suppress marker, for example, NOPMDNEWMARKER.
The PMD command-line option shows how each configuration field maps to the PMD command-line tool.
Tip: The PMD plugin and PMD command-line tool use the PMD core library. Any options that you can pass to the PMD command-line tool can also be passed to the PMD plugin.