Lists all the catalog rules that are enabled by default, except those from the “pmd-appexchange”, “eslint-lwc”, and “cpd” engines. You can filter the output to view a different set of rules. To get more information about a specific rule, use the scanner rule describe command.
Examples
Review these examples for some ideas on how to run scanner rule list.
All Rules
Invoking without filter criteria returns all the catalog rules that are enabled by default, except those from the “pmd-appexchange”, “eslint-lwc”, and “cpd” engines. This example returns a table containing all rules.
1$ sf scanner rule list
Logical OR
This example returns all rules for Apex OR JavaScript. The values supplied to a single filter are handled with a logical OR.
1$ sf scanner rule list --language apex,javascript
Replace this value:
apex,javascript: The specified language or languages.
Logical AND
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.
1$ sf scanner rule list --language apex,javascript --category Design,Security
Replace these values:
apex,javascript: The specified language or languages.
Design,Security: The category or categories of rules to run.
Exception
This example returns all rules except those in the Design or Best Practices categories. Exclude categories by specifying the negation operator.
1$ sf scanner rule list --category !Design,!Best Practices
Replace this value:
!Design,!Best Practices: The category or categories of rules to exclude.
Usage
sf scanner rule list
[-c CATEGORY_LIST]
[-e ENGINE_LIST]
[-l LANGUAGE_LIST]
[--json]
[--verbose]
Flags
-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.