Sonar-PMD is a plugin that provides coding rules from PMD for use in SonarQube.
Starting April 2022, the project has found a new home. We, jborgers and stokpop, aim to provide an active project and well-maintained sonar-pmd plugin. It is now sponsored by Rabobank.
The plugin should be available in the SonarQube marketplace and is preferably installed from within SonarQube (Administration → Marketplace → Search pmd).
Alternatively, download the latest JAR file, put it into the plugin directory (./extensions/downloads
) and restart SonarQube.
Usage should be straight forward:
Sonar PMD plugin version 4.0+ supports PMD 7 which is incompatible with PMD 6: the reason for a major release. Use version 4.0+ for child plugins with custom rules written in PMD 7, such as sonar-pmd-jpinpoint 2.0.0.
Sonar-PMD analyzes the given source code with the Java source version defined in your Gradle or Maven project. In case you are not using one of these build tools, or if that does not match the version you are using, set the sonar.java.source
property to tell PMD which version of Java your source code complies to.
Possible values: 8 to 24 and 24-preview
Table of supported versions Sonar-PMD Plugin 3.5.0 3.5.1 4.0.0 4.0.3 4.1.0 PMD 6.55.0 6.55.0 7.10.0 7.14.0 7.15.0 Max. Java Version 20-preview (*1) 20-preview (*1) 20 (*2) 24-preview 24-preview Min. SonarQube Version 9.8 9.9.4 9.9.4 9.9.4 9.9.6 Max. SonarQube Version 10.4 10.5+ 10.8+ 25.6+ 25.6+(*1) Note: Supports all tested Java 21 features; on parsing errors, warns instead of breaks.
(*2) Note: Does not support Java 20-preview nor Java 21.
PMD rules created since PMD 5.5.0 in 2016 were missing in release 4.0.3 and before.
Additionally, the sonar-pmd plugin marked the PMD rules which have a known adopted alternative in Sonar as Deprecated
. Furthermore, PMD rules which were deprecated by PMD itself had the Deprecated
mark as well, which was confusing.
With version 4.1.0 we introduce easy incorporation of new PMD rules into this plugin and thereby support the full up-to-date set of PMD rules in Sonar.
From now on, only rules that are deprecated in PMD are also marked Deprecated
in Sonar. Rules that have alternative rules in Sonar are tagged with has-sonar-alternative
, so they can be easily selected in SonarQube. The documentation will include the link to known alternative Sonar rule.
Limitations:
See details: pmd_release_notes_4.1.0.md
Support for other languagesSupport for Kotlin and Apex PMD rules is work in progress.
Sonar-PMD is licensed under the GNU Lesser General Public License, Version 3.0.
Parts of the rule descriptions displayed in SonarQube have been extracted from PMD and are licensed under a BSD-style license.
Build and test the pluginTo build the plugin and run the integration tests (use java 17 to build the plugin):
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4