sf scanner rule list

Lists all the generally available rules in the catalog that are enabled by default. You can filter the output to view a smaller set of rules. To get more information about a specific rule, use the scanner rule describe command.

Review these examples for some ideas on how to run scanner rule list.

Invoking without filter criteria returns all generally available rules. This example returns a table containing all rules.

This example returns all rules for Apex OR JavaScript. The values supplied to a single filter are handled with a logical OR.

  • apex,javascript: The specified language or languages.

This example returns all rules that target Apex or Javascript, and are members of the Design or Security categories. Different filters are combined with a logical AND.

  • apex,javascript: The specified language or languages.
  • Design,Security: The category or categories of rules to run.

This example returns all rules except those in the Design or Best Practices categories. Exclude categories by specifying the negation operator.

  • !Design,!Best Practices: The category or categories of rules to exclude.

sf scanner rule list

   [-c CATEGORY_LIST]

   [-e ENGINE_LIST]

   [-l LANGUAGE_LIST]

   [--json]

   [--verbose]

This flag is available in Code Analyzer v 3.x (generally available).

   [--preview-pmd7]

-c | --category CATEGORY_LIST

Optional

Selects rules by category. Enter multiple values as a comma-separated list.

Type: option

-e | --engine ENGINE_LIST

Optional

Selects rules by engine. Enter multiple engines as a comma-separated list.

Type: option

Possible Values: eslint | eslint-lwc | eslint-typescript | pmd | pmd-appexchange | retire-js | cpd | sfge

-l | --language LANGUAGE_LIST

Optional

Selects rules by language. Enter multiple values as a comma-separated list.

Type: option

--json

Optional

Format output as JSON.

Type: boolean

--verbose

Optional

Emit additional command output to stdout.

Type: boolean

[DEPRECATED] -r | --ruleset RULESET_LIST

Optional

Deprecated. Use category instead. Selects rules by ruleset. Enter multiple values as a comma-separated list.

Type: option

This flag is available in Code Analyzer v 3.x (generally available).

--preview-pmd7

Optional

Uses PMD version 7.0.0-rc4 instead of 6.55.0 when running PMD and CPD engines.

Type: boolean