lightning-flow-scanner
Lightning Flow Scanner is a sfdx plugin scanning the integrity and best practices of Salesforce Flows
If your root folder is not force-app, please set variable SALESFORCE_LIGHTNING_FLOW_SCANNER_DIRECTORY
lightning-flow-scanner documentation
- Version in MegaLinter: 2.16.0
- Visit Official Web Site
- See How to configure lightning-flow-scanner rules
- See Index of problems detected by lightning-flow-scanner
Configuration in MegaLinter
- Enable lightning-flow-scanner by adding
SALESFORCE_LIGHTNING_FLOW_SCANNER
in ENABLE_LINTERS variable - Disable lightning-flow-scanner by adding
SALESFORCE_LIGHTNING_FLOW_SCANNER
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
SALESFORCE_LIGHTNING_FLOW_SCANNER_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
SALESFORCE_LIGHTNING_FLOW_SCANNER_COMMAND_REMOVE_ARGUMENTS | User custom arguments to remove from command line before calling the linter Ex: -s --foo "bar" |
|
SALESFORCE_LIGHTNING_FLOW_SCANNER_PRE_COMMANDS | List of bash commands to run before the linter | None |
SALESFORCE_LIGHTNING_FLOW_SCANNER_POST_COMMANDS | List of bash commands to run after the linter | None |
SALESFORCE_LIGHTNING_FLOW_SCANNER_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling SALESFORCE_LIGHTNING_FLOW_SCANNER and its pre/post commands | None |
SALESFORCE_LIGHTNING_FLOW_SCANNER_CONFIG_FILE | lightning-flow-scanner configuration file nameUse LINTER_DEFAULT to let the linter find it |
.flow-scanner.json |
SALESFORCE_LIGHTNING_FLOW_SCANNER_RULES_PATH | Path where to find linter configuration file | Workspace folder, then MegaLinter default rules |
SALESFORCE_LIGHTNING_FLOW_SCANNER_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
SALESFORCE_LIGHTNING_FLOW_SCANNER_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
SALESFORCE_LIGHTNING_FLOW_SCANNER_CLI_EXECUTABLE | Override CLI executable | ['sfdx'] |
SALESFORCE_DIRECTORY | Directory containing SALESFORCE files (use any to always activate the linter) |
force-app |
IDE Integration
Use lightning-flow-scanner in your favorite IDE to catch errors before MegaLinter !
IDE | Extension Name | Install | |
---|---|---|---|
Visual Studio Code | Lightning Flow Scanner |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 121 | ||
salesforce | Optimized for Salesforce based projects | 54 |
Behind the scenes
How are identified applicable files
- Activated only if sub-directory
force-app
is found. (directory name can be overridden withSALESFORCE_DIRECTORY
) - If this linter is active, all files will always be linted
How the linting is performed
lightning-flow-scanner is called once on the whole project directory (project
CLI lint mode)
- filtering can not be done using MegaLinter configuration variables,it must be done using lightning-flow-scanner configuration or ignore file (if existing)
VALIDATE_ALL_CODEBASE: false
doesn't make lightning-flow-scanner analyze only updated files
Example calls
sfdx flow:scan
Help content
(node:1928) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Try to resolve the errors in the following flows:
USAGE
$ sf flow scan [-d <filepath>] [-c <filepath>] [-f
error|warning|note|never] [-r] [-p <filepath>] [-u <string>] [--apiversion
<string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
FLAGS
-c, --config=<value>
Path to configuration file
-d, --directory=<value>
Directory to scan for flows
-f, --failon=(error|warning|note|never)
[default: error] Thresold failure level (error, warning, note, or never)
defining when the command return code will be 1
-p, --sourcepath=<value>
comma-separated list of source flow paths to scan
-r, --retrieve
Force retrieve Flows from org at the start of the command
-u, --targetusername=<value>
username or alias for the target org; overrides default target org
--apiversion=<value>
override the api version used for api requests made by this command
--json
format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATA
L)
[default: warn] logging level for this command invocation
Installation on mega-linter Docker image
- Dockerfile commands :
# Parent descriptor install
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
ENV PATH="$JAVA_HOME/bin:${PATH}"
RUN sf plugins install @salesforce/plugin-packaging \
&& echo y|sfdx plugins:install sfdx-hardis \
&& npm cache clean --force || true \
&& rm -rf /root/.npm/_cacache
# Linter install
RUN echo y|sfdx plugins:install lightning-flow-scanner \
&& npm cache clean --force || true \
&& rm -rf /root/.npm/_cacache