Skip to content

Conversation

@abdeslamads
Copy link

@abdeslamads abdeslamads commented Oct 19, 2025

Note

Adds Salesforce Code Analyzer linters (Apex, Aura, LWC), installs/uses the plugin in images, updates docs/schemas/flavors/matrix, bumps SFDX Scanner docs, and refreshes generated assets and versions.

  • Salesforce:
    • New Linters: Add SALESFORCE_CODE_ANALYZER_APEX, SALESFORCE_CODE_ANALYZER_AURA, SALESFORCE_CODE_ANALYZER_LWC with descriptors, tests, and standalone Dockerfiles.
    • Image Integration: Install [email protected] in main and Salesforce flavors (Dockerfile, flavors/salesforce/Dockerfile).
    • Configs: Add default TEMPLATES/apex.yml; extend schemas with new config variables and linter keys; include in linters_matrix.json and flavors.
    • Docs: New descriptor pages + licenses; update supported/standalone linters; update mkdocs nav and site description.
    • SFDX Scanner: Docs updated to 5.5.0 (installation ARGs/badges).
  • Generated assets/versions:
    • Update linter helps (PowerShell/arm-ttk), versions (bash-exec, git_diff), and previews for Code Analyzer.

Written by Cursor Bugbot for commit fc8525b. This will update automatically on new commits. Configure here.

@echoix
Copy link
Collaborator

echoix commented Oct 19, 2025

I think there's more to change. The tool is completely different, different name, etc. It doesn't seem published as @salesforce/code-analyzer. See https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/migrate.html

There would be also maybe some keys to change, some links, docs, etc. @nvuillam I think you know more about salesforce than me. How are we supposed to install it if it is not on npm like the others? and the lwc workaround, how do we handle that?

@abdeslamads
Copy link
Author

abdeslamads commented Oct 19, 2025

@echoix yes, you're absolutely right! I know this is a big change, and I'd love to have @nvuillam guidance on making the required changes. also I tried changing the old reference and syntax of sfdx-scanner to code-analyzer. I'll try building docker image and testing it with the changes (I'm relatively new to this)

cursor[bot]

This comment was marked as outdated.

- "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

@nvuillam
Copy link
Member

thanks for the PR :)

It seems you are going the right path :)

Tip: you can locally run the test classes so it might help ^^ -> https://megalinter.io/latest/contributing/#41-visual-studio-code-dev-containers + Python VsCode extensions, i'll try to document exactly how ASAP !

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

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

cursor[bot]

This comment was marked as outdated.

@echoix
Copy link
Collaborator

echoix commented Oct 27, 2025

Could you (or any other maintener on their computer) run the build with docs to get the changes from the previous iteration fixed up with the current iteration ?

And once merged, we might need to get the jsonschema html docs updated again

cursor[bot]

This comment was marked as outdated.

@abdeslamads
Copy link
Author

Could you (or any other maintener on their computer) run the build with docs to get the changes from the previous iteration fixed up with the current iteration ?

And once merged, we might need to get the jsonschema html docs updated again

I ran the build with docs, and a lot of the docs files has been changed, should I commit and push all, or only the new generated files?

@echoix
Copy link
Collaborator

echoix commented Oct 27, 2025

At least the parts that revert the changes of 4.12.0->5.5.0 in the existing (and deprecated with this PR) linters using sfdx-scanner. And having the code-analyzer ones. Probably the parts that update tables linking them all, but it's secondary.

@echoix
Copy link
Collaborator

echoix commented Oct 29, 2025

/build

Command run output
Build command workflow started.
Installing dependencies
Running script ./build.sh
Build command workflow completed without updating files.

You can select categories and single rules by defining custom arguments (example: `SALESFORCE_SFDX_SCANNER_ARGUMENTS: -c "Best Practices,Security"`)
See more details in [Help](#help-content)
Copy link

Choose a reason for hiding this comment

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

Bug: Misleading Env Vars in Linter Documentation

The documentation for the new code-analyzer-apex, code-analyzer-aura, and code-analyzer-lwc linters incorrectly references environment variables. It uses SALESFORCE_SFDX_SCANNER_DIRECTORY (and its _AURA/_LWC variants) and SALESFORCE_SFDX_SCANNER_ARGUMENTS, which are associated with the older sfdx-scanner linters. This can cause confusion for users trying to configure the new code-analyzer tools.

Additional Locations (5)

Fix in Cursor Fix in Web

# 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


If your root folder is not **force-app**, please set variable `SALESFORCE_SFDX_SCANNER_LWC_DIRECTORY`

You can select categories and single rules by defining custom arguments (example: `SALESFORCE_SFDX_SCANNER_ARGUMENTS: -c "Best Practices,Security"`)
Copy link

Choose a reason for hiding this comment

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

Bug: LWC Analyzer Config Names Naming Inconsistency

The code-analyzer-lwc documentation incorrectly references SALESFORCE_SFDX_SCANNER_LWC_DIRECTORY and SALESFORCE_SFDX_SCANNER_ARGUMENTS for its configuration. These variable names should align with the SALESFORCE_CODE_ANALYZER_LWC_... naming convention for this linter.

Additional Locations (1)

Fix in Cursor Fix in Web

# 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

Copy link
Member

@nvuillam nvuillam left a comment

Choose a reason for hiding this comment

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

Looks good, great PR ! :)

@nvuillam
Copy link
Member

nvuillam commented Nov 3, 2025

@abdeslamads if you can just merge conflicts, i'll merge just after :)

@abdeslamads
Copy link
Author

@nvuillam waiting for the test results now ^_^ , also how can I add the deprecated property to sfdx-scanner?

@nvuillam
Copy link
Member

nvuillam commented Nov 3, 2025

@abdeslamads yes please add the deprecated :)

Last question: i thought that the yml foe code analyzer can be the same for all linters, but i see only apex.yml and the config file name has not changed for aura & lwc linters, could it be handled ? ^^

@abdeslamads
Copy link
Author

@nvuillam sorry I couldn't get my head around the failing tests -_- can you please help with that!

@nvuillam
Copy link
Member

@abdeslamads the CI was broken, i just fixed it, let's see what the tests say :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants