PMD SCA Settings

Updated 1 week ago by Copado Solutions

If you are using PMD, Copado includes built-in rule sets which can be customized according to your needs.

In order to use these default rule sets, you will need to create static code analysis settings for PMD and add the required rule sets to these settings.

To create static code analysis settings for PMD follow the steps below:

  1. Log in to the org where Copado is installed.
  2. Navigate to the Static Code Analysis Settings tab and then click on New to create a new record.
  3. Select PMD as record type:

PMD settings record type

  1. This will open a new Static Code Analysis Settings record:

  1. Fill in the New Static Code Analysis Settings Name field and click on Save.
  2. Open the Static Code Analysis Settings record you just created and click on Generate Default RuleSet:
To create Default Rules you must have the Flow User checkbox selected for your user or the Run Flows permission at permission set or profile level.

When clicking on the Generate Default RuleSet button Copado will generate a lightning data table with a total of 34 PMD rules that you can run to enforce code best practices. If the rules have been already generated, and you click this button again, a pop-up will appear with a warning that existing rules will be deleted, if you like to proceed click on the Generate Default Ruleset button, if not click on Cancel.

  1. Click on Back to come back to your SCA record.

Once you have completed the steps above, add your static code analysis settings to your pipeline:

From now on, whenever you run a static code analysis from a User Story or an Org Credential record associated with an environment inside this pipeline, it will take these SCA settings and will create a new Static Code Analysis Results record with the scan details.

Customize RuleSet

You can customize any RuleSet as required, add a new rule, edit it or delete an existing rule. Each rule has a priority within a 1 to 5 interval, and it  can be defined according to the relevance of the violated rule.

A rule with priority 1 is considered as the most important rule, and a rule with priority 5 as the least important.


How did we do?