From b18dd7b52e02c81634ebb3a4dfb05742903d6d79 Mon Sep 17 00:00:00 2001 From: Jagadeeswaran Jayaprakash <58611665+jag-j@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:47:22 -0700 Subject: [PATCH] FIX (Extension) @W-16476376@ Show Apex Guru summary on completion + restrict Apex Guru commands to apex files (#117) --- package.json | 2 +- src/apexguru/apex-guru-service.ts | 3 ++- src/lib/messages.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0a3ddd1..bf82dca 100644 --- a/package.json +++ b/package.json @@ -213,7 +213,7 @@ }, { "command": "sfca.runApexGuruAnalysisOnSelectedFile", - "when": "sfca.apexGuruEnabled" + "when": "sfca.apexGuruEnabled && resourceExtname =~ /\\.cls|\\.trigger|\\.apex/" } ] }, diff --git a/src/apexguru/apex-guru-service.ts b/src/apexguru/apex-guru-service.ts index 78b57ec..ed37aad 100644 --- a/src/apexguru/apex-guru-service.ts +++ b/src/apexguru/apex-guru-service.ts @@ -60,6 +60,7 @@ export async function runApexGuruOnFile(selection: vscode.Uri, runInfo: RunInfo) executedCommand: commandName, duration: (Date.now() - startTime).toString() }); + void vscode.window.showInformationMessage(messages.apexGuru.finishedScan(ruleResult.violations.length)); }); } catch (e) { const errMsg = e instanceof Error ? e.message : e as string; @@ -172,4 +173,4 @@ export type ApexGuruReport = { type: string; value: string; properties: ApexGuruProperty[]; -} \ No newline at end of file +} diff --git a/src/lib/messages.ts b/src/lib/messages.ts index b9968c5..9dd22ba 100644 --- a/src/lib/messages.ts +++ b/src/lib/messages.ts @@ -22,7 +22,8 @@ export const messages = { apexGuru: { progress: { message: "Code Analyzer running ApexGuru analysis." - } + }, + finishedScan: (violationCount: number) => `Scan complete. ${violationCount} violations found.` }, info: { finishedScan: (scannedCount: number, badFileCount: number, violationCount: number) => `Scan complete. Analyzed ${scannedCount} files. ${violationCount} violations found in ${badFileCount} files.`