PMD is a source code parser. It finds common programming flaws, such as unused variables, empty catch blocks, unnecessary object creation, and so on. It supports Java, JavaScript, Salesforce.com Apex, Plsql, Apache Velocity, XML, XSL, and more.
In addition, it includes CPD (copy-paste-detector, copy-paste detector). CPD in Java, C, C + +, C #, Groovy, PHP, Ruby, Fortran, JavaScript, Plsql, Apache Velocity, Scala, Objective C, Matlab, Python, Go, Duplicate code can be found in Swift and Salesforce.com Apex.
This article describes how to install and use the PMD plugin in Eclipse.
Installation
There are several ways to install Eclipse Checkstyle Plugin.
1. Via Update site
In Eclipse (Help, Install New software ...)
Input: https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/
Select to download the PMD Eclipse plugin.
2, through the offline plug-in package
Official: Https://github.com/pmd/pmd-eclipse-plugin/releases
Offline Version: ()
Project Settings
Setting PMD on Windows->preferences
Use
Right-click the project and select Pmd->check code with PMD.
To run a duplicate code detector, right-click the project node and select Pmd->find suspect cut and paste. The report will be placed in a file named Cpd-report.txt under the reports directory.
Reference:
https://waylau.com/use-pmd-for-eclipse/(the above content is transferred from this article)
Eclipse-java Code specification and quality check plugin-PMD