Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3a3a468
upgrade code analyzer to v5
abdeslamads Oct 19, 2025
a324d80
change reference of sfdx-scanner dependency to code-analyzer
abdeslamads Oct 20, 2025
b14795a
updated commands syntax to the new syntax of code-analyzer v5
abdeslamads Oct 20, 2025
15a3ce3
Merge branch 'main' into fix/upgrade-salesforce-code-analyzer-version
nvuillam Oct 25, 2025
736fec3
fix command argument per line issue
abdeslamads Oct 25, 2025
4f74eea
use new name of code-analyzer package name
abdeslamads Oct 25, 2025
297dd0e
Merge branch 'main' into fix/upgrade-salesforce-code-analyzer-version
nvuillam Oct 25, 2025
172670a
Update salesforce.megalinter-descriptor.yml
echoix Oct 26, 2025
f24a244
Update salesforce.megalinter-descriptor.yml
echoix Oct 26, 2025
d0525ea
Merge branch 'main' into fix/upgrade-salesforce-code-analyzer-version
echoix Oct 26, 2025
041d0d2
[build-command] Update generated files
github-actions[bot] Oct 26, 2025
7bb138e
Update salesforce.megalinter-descriptor.yml
echoix Oct 26, 2025
7bc1af5
Update salesforce.megalinter-descriptor.yml
echoix Oct 26, 2025
e15bb77
[build-command] Update generated files
github-actions[bot] Oct 26, 2025
37086de
Apply suggestion for renovate comment
echoix Oct 26, 2025
9394321
Merge branch 'main' into fix/upgrade-salesforce-code-analyzer-version
echoix Oct 26, 2025
7eefddf
[build-command] Update generated files
github-actions[bot] Oct 26, 2025
f63376a
add code-analyzer as a new linter and keep sfdx-scanner
abdeslamads Oct 27, 2025
107bb0b
revise entrypoint and pyproject
abdeslamads Oct 27, 2025
d04ae85
Delete .eslintignore
abdeslamads Oct 27, 2025
afddb25
revert changelog
abdeslamads Oct 27, 2025
6f1d5b6
move lightning flow scanner under sfdx scanner
abdeslamads Oct 27, 2025
e5cb09b
fix one line per argument
abdeslamads Oct 27, 2025
c0c6495
[build-command] Update generated files
github-actions[bot] Oct 27, 2025
a92768e
Merge branch 'main' into fix/upgrade-salesforce-code-analyzer-version
echoix Oct 29, 2025
9a955f5
generate documenation for new linter (code-analyzer)
abdeslamads Nov 1, 2025
7ea6c41
fix descriptor
abdeslamads Nov 2, 2025
7bb9cde
Merge branch 'main' into fix/upgrade-salesforce-code-analyzer-version
abdeslamads Nov 9, 2025
73f7d7e
modify regex for the test class
abdeslamads Nov 9, 2025
fc8525b
Merge branch 'main' into fix/upgrade-salesforce-code-analyzer-version
nvuillam Nov 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ ARG GEM_RUBOCOP_RAILS_VERSION=2.33.4
ARG GEM_RUBOCOP_RAKE_VERSION=0.7.1
# renovate: datasource=rubygems depName=rubocop-rspec
ARG GEM_RUBOCOP_RSPEC_VERSION=3.7.0
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
# renovate: datasource=npm depName=@salesforce/code-analyzer
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
# renovate: datasource=pypi depName=snakemake
ARG PIP_SNAKEMAKE_VERSION=9.13.2
# renovate: datasource=pypi depName=snakefmt
Expand Down Expand Up @@ -1100,8 +1100,8 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/refs/tags/v${REPOS
#
# rubocop installation
#
# sfdx-scanner-apex installation
&& sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
# code-analyzer-apex installation
&& sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache \
#
Expand Down
2 changes: 1 addition & 1 deletion docs/descriptors/salesforce_sfdx_scanner_apex.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ RUN sf plugins install @salesforce/plugin-packaging@${NPM_SALESFORCE_PLUGIN_PACK
ENV SF_AUTOUPDATE_DISABLE=true SF_CLI_DISABLE_AUTOUPDATE=true
# Linter install
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Version mismatch: scanner version misdocumented

The SALESFORCE_SFDX_SCANNER_VERSION was incorrectly updated to 5.5.0 in the sfdx-scanner documentation (apex.md, aura.md, lwc.md). This version is for the new code-analyzer plugin; sfdx-scanner should remain at 4.12.0 for backward compatibility. This causes a version mismatch and confusion.

Additional Locations (2)

Fix in Cursor Fix in Web

RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
Expand Down
2 changes: 1 addition & 1 deletion docs/descriptors/salesforce_sfdx_scanner_aura.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ RUN sf plugins install @salesforce/plugin-packaging@${NPM_SALESFORCE_PLUGIN_PACK
ENV SF_AUTOUPDATE_DISABLE=true SF_CLI_DISABLE_AUTOUPDATE=true
# Linter install
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect scanner version regression in plugin updater

The SALESFORCE_SFDX_SCANNER_VERSION was incorrectly updated to 5.5.0. This variable should stay at 4.12.0 for the existing sfdx-scanner plugin, as 5.5.0 is intended for the new code-analyzer plugin. This change applies the wrong scanner version.

Fix in Cursor Fix in Web

RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
Expand Down
2 changes: 1 addition & 1 deletion docs/descriptors/salesforce_sfdx_scanner_lwc.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ RUN sf plugins install @salesforce/plugin-packaging@${NPM_SALESFORCE_PLUGIN_PACK
ENV SF_AUTOUPDATE_DISABLE=true SF_CLI_DISABLE_AUTOUPDATE=true
# Linter install
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to find why it is bumped to 5.5.0, if reverted back to adding a new key for the code-analyzer version of the linters. That version doesn't exist in sfdx scanner.

RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
Expand Down
4 changes: 2 additions & 2 deletions flavors/salesforce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ ARG REPOSITORY_TRIVY_VERSION=0.67.2
# renovate: datasource=github-tags depName=aquasecurity/trivy
ARG REPOSITORY_TRIVY_SBOM_VERSION=0.67.2
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
# renovate: datasource=pypi depName=snakemake
ARG PIP_SNAKEMAKE_VERSION=9.13.2
# renovate: datasource=pypi depName=snakefmt
Expand Down Expand Up @@ -491,7 +491,7 @@ RUN curl --retry 5 --retry-delay 5 -sSLO https://github.com/pinterest/ktlint/rel
# Managed with COPY --link --from=trufflehog /usr/bin/trufflehog /usr/bin/
#
# sfdx-scanner-apex installation
&& sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
#
Expand Down
4 changes: 2 additions & 2 deletions linters/salesforce_sfdx_scanner_apex/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ARG NPM_SALESFORCE_PLUGIN_PACKAGING_VERSION=2.20.5
# renovate: datasource=npm depName=sfdx-hardis
ARG SFDX_HARDIS_VERSION=6.7.4
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
#ARG__END

####################
Expand Down Expand Up @@ -179,7 +179,7 @@ RUN sf plugins install @salesforce/plugin-packaging@${NPM_SALESFORCE_PLUGIN_PACK
ENV SF_AUTOUPDATE_DISABLE=true SF_CLI_DISABLE_AUTOUPDATE=true
#
# sfdx-scanner-apex installation
RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
RUN sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
#
Expand Down
4 changes: 2 additions & 2 deletions linters/salesforce_sfdx_scanner_aura/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ARG NPM_SALESFORCE_PLUGIN_PACKAGING_VERSION=2.20.5
# renovate: datasource=npm depName=sfdx-hardis
ARG SFDX_HARDIS_VERSION=6.7.4
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
#ARG__END

####################
Expand Down Expand Up @@ -179,7 +179,7 @@ RUN sf plugins install @salesforce/plugin-packaging@${NPM_SALESFORCE_PLUGIN_PACK
ENV SF_AUTOUPDATE_DISABLE=true SF_CLI_DISABLE_AUTOUPDATE=true
#
# sfdx-scanner-aura installation
RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
RUN sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
#
Expand Down
4 changes: 2 additions & 2 deletions linters/salesforce_sfdx_scanner_lwc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ARG NPM_SALESFORCE_PLUGIN_PACKAGING_VERSION=2.20.5
# renovate: datasource=npm depName=sfdx-hardis
ARG SFDX_HARDIS_VERSION=6.7.4
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
#ARG__END

####################
Expand Down Expand Up @@ -179,7 +179,7 @@ RUN sf plugins install @salesforce/plugin-packaging@${NPM_SALESFORCE_PLUGIN_PACK
ENV SF_AUTOUPDATE_DISABLE=true SF_CLI_DISABLE_AUTOUPDATE=true
#
# sfdx-scanner-lwc installation
RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
RUN sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
#
Expand Down
106 changes: 54 additions & 52 deletions megalinter/descriptors/salesforce.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,37 @@ linters:
linter_spdx_license: BSD-3-Clause
config_file_name: apex-pmd-ruleset.xml
cli_executable: sf
cli_config_arg_name: "--pmdconfig"
cli_config_arg_name: "--config-file"
cli_lint_extra_args:
- "scanner:run"
- "--engine"
- "pmd"
- "--target"
- '"./**/*"'
- "--severity-threshold"
- "2"
- "--outfile"
- "{{REPORT_FOLDER}}/sfdx-scanner-report-apex.csv"
- "--format"
- "csv"
- "code-analyzer run"
- "--rule-selector"
- "pmd:Recommended"
- "--workspace"
- "."
- "--output-file"
- "{{REPORT_FOLDER}}/code-analyzer-report-apex.csv"
- "--view"
- "table"
cli_lint_mode: project
cli_help_extra_args:
- "scanner:run"
- "code-analyzer run"
cli_help_extra_commands:
- "sf scanner:rule:list"
- "sf code-analyzer rules"
cli_version_extra_args:
- "plugins"
- "plugins --core"
cli_version_arg_name: ""
version_extract_regex: "(?<=@salesforce/sfdx-scanner )\\d+(\\.\\d+)+"
version_extract_regex: "(?<=code-analyzer )\\d+(\\.\\d+)+"
cli_lint_errors_count: regex_sum
cli_lint_errors_regex: "found ([0-9]+) violation"
cli_lint_errors_regex: "severity: [1-3]"
examples:
- "sf scanner:run"
- "sf code-analyzer run --rule-selector pmd:Recommended --workspace . --output-file results.csv"
install:
dockerfile:
- |-
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
# renovate: datasource=npm depName=@salesforce/code-analyzer
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
- |-
RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
RUN sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
ide:
Expand Down Expand Up @@ -151,37 +149,39 @@ linters:
cli_config_arg_name: ".eslintrc-aura.json"
cli_executable: sf
cli_lint_extra_args:
- "scanner:run"
- "--engine"
- "code-analyzer run"
- "--rule-selector"
- "eslint"
- "--workspace"
- "."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Aura Linter Uses Incorrect Rule Selector

The sfdx-scanner-aura linter's rule selector is set to a generic eslint, which applies general JavaScript linting. It should be eslint:Aura to ensure Aura-specific rules are used, aligning with the eslint:LWC and pmd:Recommended patterns in other Salesforce linters.

Fix in Cursor Fix in Web

- "--target"
- "**/aura/**/*.js"
- "--severity-threshold"
- "2"
- "--outfile"
- "{{REPORT_FOLDER}}/sfdx-scanner-report-aura.csv"
- "--format"
- "csv"
- "--output-file"
- "{{REPORT_FOLDER}}/code-analyzer-report-aura.csv"
- "--view"
- "table"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Salesforce Linter Argument Compatibility Issue

The Salesforce Aura and LWC linters mix sfdx-scanner v4 and code-analyzer v5 CLI arguments. Old v4 arguments like --target and --severity-threshold are present, which are incompatible with the v5 code-analyzer command structure (which expects --file-glob for file patterns). This causes CLI parsing errors. For Aura, the eslint argument is also incorrectly structured and should be eslint:Aura as a --rule-selector value.

Additional Locations (1)

Fix in Cursor Fix in Web

cli_lint_mode: project
cli_help_extra_args:
- "scanner:run"
- "code-analyzer run"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe (I'm not sure though) that the two args can be together. I may depend by platform, but the container only runs on Linux, so only one OS to make it work

cli_help_extra_commands:
- "sf scanner:rule:list"
- "sf code-analyzer rules --rule-selector eslint"
cli_version_extra_args:
- "plugins"
- "plugins --core"
cli_version_arg_name: ""
version_extract_regex: "(?<=@salesforce/sfdx-scanner )\\d+(\\.\\d+)+"
version_extract_regex: "(?<=code-analyzer )\\d+(\\.\\d+)+"
cli_lint_errors_count: regex_sum
cli_lint_errors_regex: "found ([0-9]+) violation"
cli_lint_errors_regex: "severity: [1-3]"
examples:
- "sf scanner:run"
- "sf code-analyzer run --rule-selector eslint --workspace . --file-glob '**/aura/**/*.js' --output-file results.csv"
install:
dockerfile:
- |-
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
# renovate: datasource=npm depName=@salesforce/code-analyzer
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
- |-
RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
RUN sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
ide:
Expand Down Expand Up @@ -227,37 +227,39 @@ linters:
cli_config_arg_name: ".eslintrc-lwc.json"
cli_executable: sf
cli_lint_extra_args:
- "scanner:run"
- "--engine"
- "eslint-lwc"
- "code-analyzer run"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abdeslamads it's one line by argument, so in that can you'll need

  • code-analyzer
  • run

- "--rule-selector"
- "eslint:LWC"
- "--workspace"
- "."
- "--target"
- "**/lwc/**/*.js"
- "--severity-threshold"
- "2"
- "--outfile"
- "{{REPORT_FOLDER}}/sfdx-scanner-report-lwc.csv"
- "--format"
- "csv"
- "--output-file"
- "{{REPORT_FOLDER}}/code-analyzer-report-lwc.csv"
- "--view"
- "table"
cli_lint_mode: project
cli_help_extra_args:
- "scanner:run"
- "code-analyzer run"
cli_help_extra_commands:
- "sf scanner:rule:list"
- "sf code-analyzer rules --rule-selector eslint:LWC"
cli_version_extra_args:
- "plugins"
- "plugins --core"
cli_version_arg_name: ""
version_extract_regex: "(?<=@salesforce/sfdx-scanner )\\d+(\\.\\d+)+"
version_extract_regex: "(?<=code-analyzer )\\d+(\\.\\d+)+"
cli_lint_errors_count: regex_sum
cli_lint_errors_regex: "found ([0-9]+) violation"
cli_lint_errors_regex: "severity: [1-3]"
examples:
- "sf scanner:run"
- "sf code-analyzer run --rule-selector eslint:LWC --workspace . --target '**/lwc/**/*.js' --output-file report.csv"
install:
dockerfile:
- |-
# renovate: datasource=npm depName=@salesforce/sfdx-scanner
ARG SALESFORCE_SFDX_SCANNER_VERSION=4.12.0
# renovate: datasource=npm depName=@salesforce/code-analyzer
ARG SALESFORCE_SFDX_SCANNER_VERSION=5.5.0
- |-
RUN sf plugins install @salesforce/sfdx-scanner@${SALESFORCE_SFDX_SCANNER_VERSION} \
RUN sf plugins install @salesforce/code-analyzer@${SALESFORCE_SFDX_SCANNER_VERSION} \
&& (npm cache clean --force || true) \
&& rm -rf /root/.npm/_cacache
ide:
Expand Down
Loading