Repository navigation
Integrate the Flow Analyzer engine into the Code Analyzer CLI - #2105
antoinesfdc wants to merge 3 commits into
Conversation
Adds @salesforce/code-analyzer-flowanalyzer-engine as a dependency, registers it in EnginePluginsFactory, and updates CodeAnalyzerConfigFactory, RulesAction and the rules command accordingly. Updates the rules/run command messages, adds a sample code-analyzer.yml that toggles engines, and updates the related tests.
| ApexGuruEngineModule.createEnginePlugin(), | ||
| UIBundleEngineModule.createEnginePlugin() | ||
| UIBundleEngineModule.createEnginePlugin(), | ||
| FlowAnalyzerEngineModule.createEnginePlugin() |
There was a problem hiding this comment.
[P1] Do not make every existing scan fail without a target org
This plugin is registered for every invocation, but the matching Core PR rejects a missing engines.flowAnalyzer.target_org while createEngineConfig() runs. Core records that as an uninstantiable engine, and CodeAnalyzer.run() appends an UninstantiableEngineRunResults for every such engine regardless of the selected rules. Consequently an existing command such as sf code-analyzer run --rule-selector eslint with no --target-org gains a critical Flow Analyzer error. Please make the engine opt-in/disabled when no org is configured, or defer the target-org requirement so unrelated scans remain unchanged.
| "@salesforce/code-analyzer-engine-api": "0.42.0", | ||
| "@salesforce/code-analyzer-eslint-engine": "0.47.0", | ||
| "@salesforce/code-analyzer-flow-engine": "0.41.0", | ||
| "@salesforce/code-analyzer-flowanalyzer-engine": "file:../code-analyzer-core/packages/code-analyzer-flowanalyzer-engine", |
There was a problem hiding this comment.
[P1] Replace the repository-external file dependency before merging
This link only resolves when code-analyzer-core happens to be checked out as a sibling directory. A normal standalone clone, npm ci, or packaged/published plugin has no ../code-analyzer-core/packages/code-analyzer-flowanalyzer-engine, and the lockfile also records this as a symlink, so installation cannot reproduce the dependency. This needs to reference a published/packageable version before the PR lands, not merely before a later release.
There was a problem hiding this comment.
This needs the project to be build by npm first isn't it ?
Runs the real engine plugins with no target org and checks that unrelated scans report no flowAnalyzer errors and that flowAnalyzer offers no rules.
Summary
Registers the new @salesforce/code-analyzer-flowanalyzer-engine in the CLI and makes it usable from the command line. The engine sends targeted Flow metadata to a Salesforce org for remote analysis. It lives in code-analyzer-core (packages/code-analyzer-flowanalyzer-engine, on the matching flowanalyzer-engine branch).
Changes
Engine registration
- package.json and package-lock.json add the code-analyzer-flowanalyzer-engine dependency.
EnginePluginsFactory adds the engine to the plugin list.
--target-org / -o flag on code-analyzer rules
-target-org to engines.flowAnalyzer.target_org as well as engines.apexguru.target_org.
Tests
Notes for reviewers