SonarQube PMD Plugin

PMD is a tool that looks for potential problems like possible bugs, dead code, suboptimal code, overcomplicated expressions or duplicate code.

License

License

Categories

Categories

Java Languages PMD Application Testing & Monitoring Code Analysis
GroupId

GroupId

org.codehaus.sonar-plugins.java
ArtifactId

ArtifactId

sonar-pmd-plugin
Last Version

Last Version

2.4
Release Date

Release Date

Type

Type

sonar-plugin
Description

Description

SonarQube PMD Plugin
PMD is a tool that looks for potential problems like possible bugs, dead code, suboptimal code, overcomplicated expressions or duplicate code.
Project URL

Project URL

http://redirect.sonarsource.com/plugins/pmd.html
Project Organization

Project Organization

SonarSource
Source Code Management

Source Code Management

https://github.com/SonarCommunity/sonar-pmd

Download sonar-pmd-plugin

Dependencies

compile (4)

Group / Artifact Type Version
org.codehaus.sonar.sslr-squid-bridge : sslr-squid-bridge jar 2.6
net.sourceforge.pmd : pmd-core jar 5.3.0
net.sourceforge.pmd : pmd-java jar 5.3.0
jdom : jdom jar 1.0

provided (3)

Group / Artifact Type Version
org.codehaus.sonar : sonar-java-api jar 4.5.4
org.codehaus.sonar : sonar-plugin-api jar 4.5.4
org.codehaus.sonar-plugins.java : sonar-java-plugin sonar-plugin 2.5.1

test (4)

Group / Artifact Type Version
org.apache.maven : maven-project jar 2.0.7
org.codehaus.sonar : sonar-testing-harness jar 4.5.4
org.mockito : mockito-all jar 1.9.5
commons-io : commons-io jar 2.4

Project Modules

There are no modules declared in this project.

SonarQube PMD Plugin Maven Central Build Status SonarStatus SonarStatus

Sonar-PMD is a plugin that provides coding rules from PMD.

For a list of all rules and their status, see: RULES.md

Installation

The plugin is available in the SonarQube marketplace and should preferably be installed from within SonarQube (Administration --> Marketplace --> Search pmd).

Alternatively, download the latest JAR file, put it into the plugin directory (./extensions/plugins) and restart SonarQube.

Usage

Usage should be straight forward:

  1. Activate some PMD rules in your quality profile.
  2. Run an analysis.

Troubleshooting

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, PMD uses the default Java version - which is 1.6.

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:

  • 1.4
  • 1.5 or 5
  • 1.6 or 6
  • 1.7 or 7
  • 1.8 or 8
  • 9
  • 10
  • 11

Description / Features

PMD Plugin 2.0 2.1 2.2 2.3 2.4.1 2.5 2.6 3.0.0 3.1.x 3.2.x
PMD 4.3 4.3 5.1.1 5.2.1 5.3.1 5.4.0 5.4.2 5.4.2 6.9.0 6.10.0
Max. supported Java Version 1.7 1.8 1.8 11
Min. SonarQube Version 4.5.4 4.5.4 6.6 6.6

A majority of the PMD rules have been rewritten in the Java plugin. Rewritten rules are marked "Deprecated" in the PMD plugin, but a concise summary of replaced rules is available.

Rules on test

PMD tool provides some rules that can check the code of JUnit tests. Please note that these rules (and only these rules) will be applied only on the test files of your project.

License

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.

org.codehaus.sonar-plugins.java

SonarSource

Continuous Code Quality

Versions

Version
2.4
2.3
2.2
2.1
2.1-RC1
2.0
1.5
1.5-RC2
1.5-RC1
1.4
1.3
1.3-RC1
1.2
1.2-RC2
1.2-RC1
1.1
1.1-RC2
1.1-RC1