Enable SCA Apex PMD validation criteria.

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.

How to set the Apex PMD criteria?

  1. Log into the ARM account.

  2. Go to Admin > My Account.

  3. Go to Validation Criteria - Static Code Analysis section and select the Enable Validation Criteria - SCA checkbox.

  4. Select ApexPMD and now set the priorities for it.

  5. 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

  6. Click Save to save the changes.

  7. 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.

  8. Select the Enable criteria-based Review Process checkbox.

  9. Enable the second checkbox, i.e., Should pass validation criteria for Static Code Analysis checkbox.

  10. Choose ApexPMD.

  11. 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).

  12. 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.

Last updated