-
-
Notifications
You must be signed in to change notification settings - Fork 278
upgrade code analyzer to v5 #6386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
upgrade code analyzer to v5 #6386
Conversation
|
I think there's more to change. The tool is completely different, different name, etc. It doesn't seem published as 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? |
|
@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) |
| - "scanner:run" | ||
| - "--engine" | ||
| - "eslint-lwc" | ||
| - "code-analyzer run" |
There was a problem hiding this comment.
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
|
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 ! |
| cli_lint_mode: project | ||
| cli_help_extra_args: | ||
| - "scanner:run" | ||
| - "code-analyzer run" |
There was a problem hiding this comment.
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
| @@ -1,133 +1,5 @@ | |||
| [build-system] | |||
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
|
/build
|
|
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? |
|
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. |
|
/build
|
| 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) |
There was a problem hiding this comment.
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)
megalinter/descriptors/salesforce.megalinter-descriptor.yml#L135-L140megalinter/descriptors/salesforce.megalinter-descriptor.yml#L215-L220docs/descriptors/salesforce_code_analyzer_apex.md#L22-L25docs/descriptors/salesforce_code_analyzer_aura.md#L23-L26docs/descriptors/salesforce_code_analyzer_lwc.md#L24-L25
| # 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 |
There was a problem hiding this comment.
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)
|
|
||
| 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"`) |
There was a problem hiding this comment.
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)
| # 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 |
There was a problem hiding this comment.
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.
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.
code-analyzerv5 linters:SALESFORCE_CODE_ANALYZER_APEX,SALESFORCE_CODE_ANALYZER_AURA,SALESFORCE_CODE_ANALYZER_LWC(descriptors, docs, licenses, tests, mkdocs nav, supported/standalone lists).TEMPLATES/apex.ymland link previews.[email protected]in main and Salesforce flavorDockerfiles; add dedicated standalone Dockerfiles for each new linter.linters_matrix.jsonand flavors to include new linters.Written by Cursor Bugbot for commit 7ea6c41. This will update automatically on new commits. Configure here.