Skip to content

How to setup the SFDX Scanner CLI Plugin for Static Code Analysis

Coding With The Force edited this page Oct 18, 2020 · 3 revisions

How to setup the SFDX Scanner CLI Plugin for Static Code Analysis

  1. Install the Java Development Kit (JDK) version 8 or higher

  2. Install the Salesforce CLI

  3. Install the sfdx scanner plugin for the Salesforce CLI by opening up a terminal window and running the following command:

sfdx plugins:install @salesforce/sfdx-scanner
  1. Create a Salesforce Project in VSCode

  2. Open the Terminal in VSCode and run the following command to scan your entire codebase for all static code issues (make sure to replace pathToFile.csv with the actual path for your file):

sfdx scanner:run --target "**/default/**" --format "csv" --outfile "pathToFile.csv" 
  1. The above command will output a csv that shows you all of the issues with the code in your org within a few seconds (unless you have a mega code-base. It may take a few minutes then).

  2. For more information on the wealth of configuration options you have with this cli plugin, please check out the supplementary info links.


Supplementary Info

SFDX Scanner Github Repo

SFDX Scanner Documentation

Clone this wiki locally