PMD SCA Settings
If your are using PMD, Copado includes a 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.
By clicking on the Generate Default RuleSet button you are retrieving the default PMD rules that you can run to enforce code best practices.
- 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.
- A rule with priority 1 is considered as the most important rule, and a rule with priority 5 as the least important.