-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
|
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.
nvuillam
left a comment
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.
Looks good, great PR ! :)
|
@abdeslamads if you can just merge conflicts, i'll merge just after :) |
|
@nvuillam waiting for the test results now ^_^ , also how can I add the deprecated property to sfdx-scanner? |
|
@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 ? ^^ |
|
@nvuillam sorry I couldn't get my head around the failing tests -_- can you please help with that! |
|
@abdeslamads the CI was broken, i just fixed it, let's see what the tests say :) |
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_CODE_ANALYZER_APEX,SALESFORCE_CODE_ANALYZER_AURA,SALESFORCE_CODE_ANALYZER_LWCwith descriptors, tests, and standalone Dockerfiles.[email protected]in main and Salesforce flavors (Dockerfile,flavors/salesforce/Dockerfile).TEMPLATES/apex.yml; extend schemas with new config variables and linter keys; include inlinters_matrix.jsonand flavors.5.5.0(installation ARGs/badges).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.