PMD SCA Settings
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:
- Log in to the org where Copado is installed.
- Navigate to the Static Code Analysis Settings tab and then click on New to create a new record.
- Select PMD as record type:
- This will open a new Static Code Analysis Settings record:
- Fill in the New Static Code Analysis Settings Name field and click on Save.
- Open the Static Code Analysis Settings record you just created and click on Generate Default RuleSet:
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.
- 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.
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.