Tuesday, May 5, 2020

PMD Source code analyzer | Automated Apex Code Review

What is PMD?
PMD stands for Programming Mistake Detector is an open source code analyzer tool which is used to generate code quality report.
Here we will discuss about how PMD can be used to generate code quality report for standalone application.
Step 1:
Download PMD from here à Unzip the download file
Step 2:
Now Retrieve the code through package.xml from workbench-
Now unzip the source code after downloaded from workbench.
Step 3:
Run the below pmd command to generate the report




You can define the rule set as per your need or else you can use the built-in rule set. See the below table for build in rule set path
Rule Name
Description
Rule Set Path
Best Practices
Rules which enforce generally accepted best practices.
Category/apex/bestpractices.xml
Code Style
Rules which enforce a specific coding style.
Category/apex/codestyle.xml
Design
Rules that help you discover design issues.
Category/apex/design.xml
Documentation
Rules that are related to code documentation
Category/apex/documentation.xml
Error Prone
Rules to detect constructs that are either broken, extremely confusing or prone to runtime errors.
Category/apex/errorprone.xml
Performance
Rules that flag suboptimal code.
Category/apex/performance.xml
Security
Rules that flag potential security flaws.
category/apex/security.xml


No comments:

Post a Comment