Run analysis locally using SFDX
This article will guide you through how to run the code analysis manually using our CodeScan Plugin and Salesforce CLI.
Prerequisites
To run the code analysis manually using our CodeScan Plugin and Salesforce CLI, first make sure you have:
Salesforce CLI installed. Click HERE to download the Salesforce CLI and its dependencies.
Java 17
NodeJS 18
To install the CodeScan SFDX plugin, follow these steps:
Use
sfdx plugins:install sfdx-codescan-plugin
.You'll be prompted that Salesforce does not sign this plugin; type Y to continue.
Check the installation using sfdx plugins.
You're ready to run a scan once the installation is completed. To run this scan, follow these steps:
Open Bash CLI like Git Bash, etc.
Now, go to the folder with the project sources you want to run a scan on and enter the command as shown below:
Note: To find your Project Key and the Organization Key, click on the respective links below:
Project keys differ from project to project as the organization and project keys are unique.
This will start the analysis directly on the CodeScan cloud.
To learn how to generate a Security Token, click HERE.
If you want to run the analysis in CodeScan Self-Hosted, CodeScan Cloud EU, or CodeScan Cloud AUS, then make the following changes in the command:
Add --server <Server Name>
Replace Project key
Replace Organization key
Replace Token
Replace your server name (if applicable).
To view a list of parameters and flags which you can use, run the following command:
sfdx help codescan:run
Last updated