Run Static Code Analysis
Running static code analysis (SCA) is a useful practice that allows you to review code and detect errors throughout the deployment lifecycle.
There are many places where you can execute code analysis with Copado, which we will describe in more detail below. But prior to running static code analysis, you will need to define the static code analysis settings and assign them to a pipeline. To learn more about this, check out the following links:
You can request status code analysis for all classes in a Salesforce org to run from a Credential record if the credential is included in a pipeline with SCA settings assigned. To do this, navigate to the Credential record and click on Run Static Code Analysis:
On a user story with an environment inside a pipeline that has SCA settings assigned, you can request static code analysis for Apex classes related to it. To do this, navigate to the User Story record and click on the drop-down menu at the top right corner. Then click on Run Static Code Analysis:
When executing a scheduled job, you can select the Static Code Analysis on Credential or the Static Code Analysis on User Story webhooks to run static code on an existing credential or user story. Once the job is executed the results will be listed in the Credentials or User Story records:
Static Code Analysis Results
Depending on the SCA tool you are using, results will be displayed in a different way. For more information, please check out the article PMD SCA Results if you are using PMD or CodeScan SCA Results if you are using CodeScan.