Apex PMD
Last updated
Last updated
PMD stands for Programming Mistake Detector. It is a source code analyzer that finds common mistakes in your code, like unused variables, if-else statements without braces, naming conventions of methods, SOQL in loops, and many more. It also includes CPD (for Copy/Paste Detector), which finds duplicate code in your files and makes you aware of improvements to make your code reusable.
Supported Version: ApexPMD upgraded to the latest 6.49 version.
Log in to your AutoRABIT account.
From the AutoRABIT home page, hover your mouse over the Admin module and select the option: My Account.
Go to the Plugins section.
Click on the ApexPMD checkbox under Static Code Analysis.
If you do have separate Apex PMD rules that you would like to carry out in AutoRABIT, you can upload the same. Click Browse to search for the file in your local machine. Usually, the file is in XML format. Once done, click Upload.
If the user has not uploaded any rules file, AutoRABIT will use the default Apex PMD rules file. However, you can update some of the fields in it.
Download the default rule set in your local machine using the link as shown below.
Edit the content and upload it once again.
Click Save and you are all set with ApexPMD Integration.
Point to Remember: The current build of AutoRABIT supports Apex PMD with Apex Classes, Apex Visualforce pages, and Triggers.
Go to the New CI Job screen.
Select any one of the criteria for your CI job. For example, Deploy from Salesforce Org.
Enter a descriptive name in the CI Job Name field.
In the Build section, select your Salesforce Org or Version Control Repo/Branch.
Select the Run Static Analysis Report checkbox and choose Apex PMD.
AutoRABIT allows you to set the criteria for running the ApexPMD SCA tool. This means running for all the apex classes or stating the period from when it will run. Also, you can set the priority, which means if the priority set is not achieved, the current build is unstable. This helps us in reporting the code quality of the developer team.
Fill in the remaining fields as per your requirements and click on Save.
Once the build is triggered for your CI Job, the SCA report can be found under the Build Details section on the CI Job Result page.