diff --git a/package.json b/package.json index abef372..fac39f8 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ }, { "command": "sfca.runDfa", - "title": "***SFDX: Run Graph-Engine Based Analysis***" + "title": "SFDX: Scan Project with Graph Engine Path-Based Analysis" }, { "command": "sfca.runApexGuruAnalysisOnSelectedFile", @@ -169,10 +169,10 @@ "default": false, "description": "Discover critical problems and performance issues in your Apex code with ApexGuru, which analyzes your Apex files for you. This feature is in a closed pilot; contact your account representative to learn more." }, - "codeAnalyzer.deltaRuns.enabled": { + "codeAnalyzer.partialGraphEngineScans.enabled": { "type": "boolean", "default": false, - "description": "***Enable delta run of Salesforce Graph Engine***" + "description": "Enables partial Salesforce Graph Engine scans on only the code you've modified since the initial full scan. (Beta)" } } }, @@ -192,7 +192,7 @@ }, { "command": "sfca.runDfa", - "when": "true" + "when": "sfca.partialRunsEnabled" }, { "command": "sfca.removeDiagnosticsOnActiveFile", diff --git a/src/extension.ts b/src/extension.ts index 7dc3cca..9109a8b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -155,7 +155,8 @@ export async function activate(context: vscode.ExtensionContext): Promise { await _runDfa(context); savedFilesCache.clear(); @@ -212,26 +213,28 @@ export function createTempDirectory(): string { async function _runDfa(context: vscode.ExtensionContext) { if (violationsCacheExists()) { + const partialScanText = 'Partial scan: Scan only the code that you changed since the previous scan.'; + const fullScanText = 'Full scan: Scan all the code in this project again.'; const choice = await vscode.window.showQuickPick( - ['***Yes***', '***No***'], + [partialScanText, fullScanText], { - placeHolder: '***We identified a previous Salesforce Graph Engine run. Do you want to only run the previously failed violations from that run?***', + placeHolder: 'You previously scanned this code using Salesforce Graph Engine. What kind of scan do you want to run now?', canPickMany: false, ignoreFocusOut: true } ); // Default to "Yes" if no choice is made - const rerunChangedOnly = choice == '***Yes***'; + const rerunChangedOnly = choice == partialScanText; if (rerunChangedOnly) { const deltaRunTargets = DeltaRunFunctions.getDeltaRunTarget(sfgeCachePath, savedFilesCache); if (deltaRunTargets.length == 0) { - void vscode.window.showInformationMessage('***No local changes found that would change the outcome of previous SFGE full run.***'); + void vscode.window.showInformationMessage("Your local changes didn't change the outcome of the previous full Salesforce Graph Engine scan."); return } await runDfaOnSelectMethods(context, deltaRunTargets); } else { - void vscode.window.showWarningMessage('***A full run of the graph engine will happen in the background. You can cancel this by clicking on the status progress.***'); + void vscode.window.showWarningMessage('A full Salesforce Graph Engine scan is running in the background. You can cancel it by clicking the progress bar.'); await runDfaOnWorkspace(context); } } else { @@ -252,7 +255,7 @@ async function runDfaOnSelectMethods(context: vscode.ExtensionContext, selectedM customCancellationToken.token.onCancellationRequested(async () => { customCancellationToken?.dispose(); customCancellationToken = null; - await vscode.window.showInformationMessage(messages.graphEngine.noViolationsFound); + await vscode.window.showInformationMessage(messages.graphEngine.noViolationsFoundForPartialRuns); return; }); diff --git a/src/lib/messages.ts b/src/lib/messages.ts index 41dee99..1993a0d 100644 --- a/src/lib/messages.ts +++ b/src/lib/messages.ts @@ -30,6 +30,7 @@ export const messages = { }, graphEngine: { noViolationsFound: "Scan was completed. No violations found.", + noViolationsFoundForPartialRuns: "Partial Salesforce Graph Engine scan of the changed code completed, and no violations found. IMPORTANT: You might still have violations in the code that you haven't changed since the previous full scan.", resultsTab: "Graph Engine Results", spinnerText: 'Running Graph Engine analysis...', statusBarName: "Graph Engine Analysis", diff --git a/src/lib/settings.ts b/src/lib/settings.ts index 497698b..9e4010f 100644 --- a/src/lib/settings.ts +++ b/src/lib/settings.ts @@ -54,7 +54,7 @@ export class SettingsManager { return vscode.workspace.getConfiguration('codeAnalyzer.apexGuru').get('enabled'); } - public static getSfgeDeltaRunsEnabled(): boolean { - return vscode.workspace.getConfiguration('codeAnalyzer.deltaRuns').get('enabled'); + public static getSfgePartialSfgeRunsEnabled(): boolean { + return vscode.workspace.getConfiguration('codeAnalyzer.partialGraphEngineScans').get('enabled'); } } \ No newline at end of file diff --git a/src/test/suite/settings.test.ts b/src/test/suite/settings.test.ts index 3fda319..2f1e897 100644 --- a/src/test/suite/settings.test.ts +++ b/src/test/suite/settings.test.ts @@ -189,15 +189,15 @@ suite('SettingsManager Test Suite', () => { test('getSfgeDeltaRunsEnabled should return the delta runs enabled setting', () => { // ===== SETUP ===== const mockAnalyzeOnSaveEnabled = true; - getConfigurationStub.withArgs('codeAnalyzer.deltaRuns').returns({ + getConfigurationStub.withArgs('codeAnalyzer.partialGraphEngineScans').returns({ get: Sinon.stub().returns(mockAnalyzeOnSaveEnabled) }); // ===== TEST ===== - const result = SettingsManager.getSfgeDeltaRunsEnabled(); + const result = SettingsManager.getSfgePartialSfgeRunsEnabled(); // ===== ASSERTIONS ===== expect(result).to.equal(mockAnalyzeOnSaveEnabled); - expect(getConfigurationStub.calledOnceWith('codeAnalyzer.deltaRuns')).to.be.true; + expect(getConfigurationStub.calledOnceWith('codeAnalyzer.partialGraphEngineScans')).to.be.true; }); }); \ No newline at end of file