Enable SCA Apex PMD validation criteria.
Last updated
Last updated
The org administrator can define global validation criteria to enforce Static Code Analysis (SCA) tools such as Apex PMD across CI jobs, gated commits, and merge jobs. Based on the priority set, the build will be successful only if the criteria are met.
Before you set the SCA criteria, ensure the following:
Apex PMD is integrated with ARM.
You are an org administrator or have the privilege to access the My Account page.
Log into the ARM account.
Go to Admin > My Account.
Go to Validation Criteria - Static Code Analysis section and select the Enable Validation Criteria - SCA checkbox.
Select ApexPMD and now set the priorities for it.
In the screenshot below, the Priority-3 is set to greater than 5, which means if Priority-3 related errors are more than 5, it should pass, or else it will fail. This means if Priority-3 related errors are more than 5, it should pass, or
Click Save to save the changes.
Now, go to the Commit Validation - Approval Settings section. You can enforce the SCA criteria to run for all commits before being merged to the version control branch.
Select the Enable criteria-based Review Process checkbox.
Enable the second checkbox, i.e., Should pass validation criteria for Static Code Analysis checkbox.
Choose ApexPMD.
Select the Auto reject commit process if the criteria are not met checkbox to auto-reject the commit if the set standards are not met (as mentioned in Step-2).
Click Save.
In the below screenshot, the SCA criteria were fulfilled (Priority-3 should be greater than 5), and the validation commit was moved to the Approved state as expected.