Run Static Code Analysis

Updated 3 months ago by Copado Solutions

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 a 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: 


Org Credential

You can request status code analysis for all classes in a Salesforce org to run from an Org Credential record if the org credential is included in a pipeline with SCA settings assigned. To do this, navigate to the Org Credential record and click on Run Static Code Analysis:



User Story

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:

Scheduled Job

When executing a scheduled job, you can select the Static Code Analysis on Org Credential or the Static Code Analysis on User Story webhooks to run static code on an existing org credential or user story. Once the job is executed the results will be listed in the Org 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.

How did we do?