Set Up Code Analyzer v5 (Developer Preview)

This section describes how to get started with Code Analyzer v5 by installing the CLI plugin. You can install v5 of the plugin alongside v4 and use both sets of commands at the same time.

This feature is available as a developer preview. The feature isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. All commands, parameters, and other features are subject to change or deprecation at any time, with or without notice. Don't implement functionality developed with these commands or tools.

The Code Analyzer v5 Plugin includes these commands:

  • code-analyzer rules: List the rules that are available to analyze your code.

  • code-analyzer run: Analyze your code with a selection of rules to ensure good coding practices.

  • code-analyzer config: Display the Code Analyzer configuration state and optionally write it to a file.

    The code-analyzer config command is hidden and only partially implemented. We mention it only because you can still use it to generate a code-analyzer.yml file, which is a useful feature and described later in this document.

Code Analyzer is a Salesforce CLI plugin, so you must install Salesforce CLI on your computer. See Install Salesforce CLI for details.

Run this command to install the Code Analyzer v5 plugin:

To verify that you’ve installed it correctly, run this command:

The output shows all the core and user plugins currently installed in Salesforce CLI. If Code Analyzer v5 is installed, you see this entry in the output:

Run this command to list the v5 commands:

To view the full help about a specific command, including the full description and examples, use the --help flag.

You can also view the same information online in the Salesforce CLI Command Reference.

To view short help, use the -h flag:

To update Code Analyzer v5, rerun the installation command.

To uninstall Code Analyzer v5, run this command.