Skip to content

Conversation

@abdeslamads
Copy link

@abdeslamads abdeslamads commented Oct 19, 2025

Note

Integrates Salesforce Code Analyzer v5 as new Apex/Aura/LWC linters, wires installs into images, adds config/tests/docs, and updates schemas/matrix and SFDX scanner refs.

  • Salesforce linters:
    • Add new code-analyzer v5 linters: SALESFORCE_CODE_ANALYZER_APEX, SALESFORCE_CODE_ANALYZER_AURA, SALESFORCE_CODE_ANALYZER_LWC (descriptors, docs, licenses, tests, mkdocs nav, supported/standalone lists).
    • Provide default config TEMPLATES/apex.yml and link previews.
  • Build/Docker:
    • Install [email protected] in main and Salesforce flavor Dockerfiles; add dedicated standalone Dockerfiles for each new linter.
  • Configs/Schemas:
    • Extend schemas to include new linter keys and configuration variables.
    • Update linters_matrix.json and flavors to include new linters.
  • Docs:
    • Update site description counts; add new descriptor pages and badges; include new linters in tables.
    • Update SFDX scanner docs to reference latest plugin version in install snippets.
  • Misc versions/help:
    • Refresh generated help/version data (e.g., bash, powershell, git, java help text).

Written by Cursor Bugbot for commit 7ea6c41. 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.

cursor[bot]

This comment was marked as outdated.

@@ -1,133 +1,5 @@
[build-system]
Copy link
Member

Choose a reason for hiding this comment

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

@abdeslamads this is very strange to almost empty pyproject.toml ^^
cc @echoix

Are you up to date with main branch ?

Copy link
Author

Choose a reason for hiding this comment

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

I copied the file's content from the main branch after it has been updated automatically by the build script

Copy link
Collaborator

@echoix echoix left a comment

Choose a reason for hiding this comment

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

I know it's getting a long review ping-pong game, but it's getting closer and closer.

# 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.

cursor[bot]

This comment was marked as outdated.

@echoix
Copy link
Collaborator

echoix commented Oct 27, 2025

/build

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

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

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