diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8320b4b..3362001c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ to VSC marketplace and creates GitHub release. You can verify the release by: -* Looking on the [Marketplace page](https://marketplace.visualstudio.com/items?itemName=kubeshop.monokle-sarif-viewer) to see if latest release is there. +* Looking on the [Marketplace page](https://marketplace.visualstudio.com/items?itemName=kubeshop.monokle-sarif) to see if latest release is there. * Looking on GitHub [release list](https://github.com/kubeshop/vscode-sarif/releases) to see if latest release is there. --- diff --git a/README.md b/README.md index d3953776..9ac783b1 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ We welcome feedback via [issues](https://github.com/microsoft/sarif-vscode-exten ## API An [extension-to-extension public API](https://code.visualstudio.com/api/references/vscode-api#extensions) is offered. This API is defined at `src/extension/index.d.ts`. An example of another extension calling this extension: ```javascript -const sarifExt = extensions.getExtension('MS-SarifVSCode.sarif-viewer'); +const sarifExt = extensions.getExtension('kubeshop.monokle-sarif'); if (!sarifExt.isActive) await sarifExt.activate(); await sarifExt.exports.openLogs([ Uri.file('c:/samples/demo.sarif'), diff --git a/package-lock.json b/package-lock.json index 4ebe3cbd..b5ae8f16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "monokle-sarif-viewer", + "name": "monokle-sarif", "version": "3.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "monokle-sarif-viewer", + "name": "monokle-sarif", "version": "3.4.2", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index ac6c9707..54edc471 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "monokle-sarif-viewer", + "name": "monokle-sarif", "displayName": "Monokle SARIF Viewer", "description": "Adds support for viewing SARIF logs, fork of Sarif Viewer by Microsoft Corporation", "author": "Kubeshop", @@ -37,16 +37,16 @@ "configuration": { "title": "SARIF Viewer", "properties": { - "sarif-viewer.rootpaths": { + "monokle-sarif.rootpaths": { "type": "array", "description": "Add root paths for default mapping of locations in the sarif file that can't be found (ex. the local root directory of your repo)." }, - "sarif-viewer.explorer.openWhenNoResults": { + "monokle-sarif.explorer.openWhenNoResults": { "description": "Indicates whether to open the explorer when there are no results in the log.", "type": "boolean", "default": false }, - "sarif-viewer.connectToGithubCodeScanning": { + "monokle-sarif.connectToGithubCodeScanning": { "description": "Connect to GitHub and display any code scanning results. Setting takes effect on editor restart.", "type": "string", "enum": [ @@ -61,7 +61,7 @@ ], "default": "off" }, - "sarif-viewer.updateChannel": { + "monokle-sarif.updateChannel": { "description": "Specifies the type of updates the extension receives.", "type": "string", "enum": [ @@ -75,7 +75,7 @@ "default": "Default", "scope": "application" }, - "sarif-viewer.githubCodeScanningInitialAlert": { + "monokle-sarif.githubCodeScanningInitialAlert": { "description": "Specifies an initial alert to load into the UI on when the IDE starts. This is meant to be set programmatically.", "type": "string", "ignoreSync": true, @@ -93,43 +93,43 @@ ], "commands": [ { - "command": "sarif.showPanel", - "category": "SARIF", + "command": "monokle-sarif.showPanel", + "category": "Monokle Sarif", "title": "Show Panel" }, { - "command": "sarif.clearState", - "category": "SARIF", + "command": "monokle-sarif.clearState", + "category": "Monokle Sarif", "title": "Clear State" }, { - "command": "sarif.alertDismissFalsePositive", - "category": "SARIF", + "command": "monokle-sarif.alertDismissFalsePositive", + "category": "Monokle Sarif", "title": "Dismiss - False Positive" }, { - "command": "sarif.alertDismissUsedInTests", - "category": "SARIF", + "command": "monokle-sarif.alertDismissUsedInTests", + "category": "Monokle Sarif", "title": "Dismiss - Used in Tests" }, { - "command": "sarif.alertDismissWontFix", - "category": "SARIF", + "command": "monokle-sarif.alertDismissWontFix", + "category": "Monokle Sarif", "title": "Dismiss - Won't Fix" } ], "menus": { "webview/context": [ { - "command": "sarif.alertDismissFalsePositive", + "command": "monokle-sarif.alertDismissFalsePositive", "when": "webviewId == 'sarif' && webviewSection == 'isGithubAlert'" }, { - "command": "sarif.alertDismissUsedInTests", + "command": "monokle-sarif.alertDismissUsedInTests", "when": "webviewId == 'sarif' && webviewSection == 'isGithubAlert'" }, { - "command": "sarif.alertDismissWontFix", + "command": "monokle-sarif.alertDismissWontFix", "when": "webviewId == 'sarif' && webviewSection == 'isGithubAlert'" } ] diff --git a/src/extension/index.activateFixes.ts b/src/extension/index.activateFixes.ts index c4216af2..2f9642fa 100644 --- a/src/extension/index.activateFixes.ts +++ b/src/extension/index.activateFixes.ts @@ -35,9 +35,9 @@ export function activateFixes(disposables: Disposable[], store: Pick new ResultQuickFix(diagnostic, result, fix)) ?? [], ...result.properties?.['github/alertNumber'] === undefined ? [] : [ // Assumes only GitHub will use `github/alertNumber`. - new DismissCodeAction(diagnostic, result, 'sarif.alertDismissFalsePositive', 'False Positive'), - new DismissCodeAction(diagnostic, result, 'sarif.alertDismissUsedInTests', 'Used in Tests'), - new DismissCodeAction(diagnostic, result, 'sarif.alertDismissWontFix', 'Won\'t Fix'), + new DismissCodeAction(diagnostic, result, 'monokle-sarif.alertDismissFalsePositive', 'False Positive'), + new DismissCodeAction(diagnostic, result, 'monokle-sarif.alertDismissUsedInTests', 'Used in Tests'), + new DismissCodeAction(diagnostic, result, 'monokle-sarif.alertDismissWontFix', 'Won\'t Fix'), ], ]; }, diff --git a/src/extension/index.activateGithubAnalyses.ts b/src/extension/index.activateGithubAnalyses.ts index 43140d70..0113492d 100644 --- a/src/extension/index.activateGithubAnalyses.ts +++ b/src/extension/index.activateGithubAnalyses.ts @@ -71,16 +71,16 @@ type ConnectToGithubCodeScanning = 'off' | 'on' | 'prompt' | 'injected' | undefi export function activateGithubAnalyses(disposables: Disposable[], store: Store, panel: Panel, outputChannel: OutputChannel) { disposables.push(workspace.onDidChangeConfiguration(e => { - if (!e.affectsConfiguration('sarif-viewer.connectToGithubCodeScanning')) return; - const connectToGithubCodeScanning = workspace.getConfiguration('sarif-viewer').get('connectToGithubCodeScanning'); + if (!e.affectsConfiguration('monokle-sarif.connectToGithubCodeScanning')) return; + const connectToGithubCodeScanning = workspace.getConfiguration('monokle-sarif').get('connectToGithubCodeScanning'); sendGithubConfig(connectToGithubCodeScanning ?? 'undefined'); })); // See configurations comments at the bottom of this file. - const fullCodeScanningAlert = workspace.getConfiguration('sarif-viewer').get('githubCodeScanningInitialAlert'); + const fullCodeScanningAlert = workspace.getConfiguration('monokle-sarif').get('githubCodeScanningInitialAlert'); const connectToGithubCodeScanning: ConnectToGithubCodeScanning = fullCodeScanningAlert ? 'injected' - : workspace.getConfiguration('sarif-viewer').get('connectToGithubCodeScanning'); + : workspace.getConfiguration('monokle-sarif').get('connectToGithubCodeScanning'); outputChannel.appendLine(`Connect to GitHub Code Scanning: ${connectToGithubCodeScanning}.`); if (connectToGithubCodeScanning === 'off') { return; @@ -152,7 +152,7 @@ export function activateGithubAnalyses(disposables: Disposable[], store: Store, sendGithubPromptChoice(choice); if (choice === 'Never') { outputChannel.appendLine('Never connect to GitHub Code Scanning by user request.'); - workspace.getConfiguration('sarif-viewer').update('connectToGithubCodeScanning', 'off'); + workspace.getConfiguration('monokle-sarif').update('connectToGithubCodeScanning', 'off'); } else if (choice === 'Connect') { const analysisFound = await window.withProgress({ location: ProgressLocation.Notification }, async progress => { progress.report({ increment: 20 }); // 20 is arbitrary as we have a non-deterministic number of steps. @@ -161,7 +161,7 @@ export function activateGithubAnalyses(disposables: Disposable[], store: Store, progress.report({ message, increment: 20 }); }); if (analysisInfo) { - workspace.getConfiguration('sarif-viewer').update('connectToGithubCodeScanning', 'on'); + workspace.getConfiguration('monokle-sarif').update('connectToGithubCodeScanning', 'on'); await panel.show(); updateAnalysisInfo(analysisInfo); beginWatch(repo); @@ -176,7 +176,7 @@ export function activateGithubAnalyses(disposables: Disposable[], store: Store, ); sendGithubAnalysisFound(`Not Found: ${choiceTryAgain ?? 'undefined'}`); if (choiceTryAgain === 'No') { - workspace.getConfiguration('sarif-viewer').update('connectToGithubCodeScanning', 'off'); + workspace.getConfiguration('monokle-sarif').update('connectToGithubCodeScanning', 'off'); } } else { sendGithubAnalysisFound('Found'); @@ -196,7 +196,7 @@ export function activateGithubAnalyses(disposables: Disposable[], store: Store, // Now that the analysis has been successfully applied, avoid re-applying it in the future. // Make sure to update the config value to '' instead of `undefined` to ensure that the // default value is not used. This default value may have been injected by a codespace. - await workspace.getConfiguration('sarif-viewer').update('githubCodeScanningInitialAlert', '', ConfigurationTarget.Global); + await workspace.getConfiguration('monokle-sarif').update('githubCodeScanningInitialAlert', '', ConfigurationTarget.Global); } else { // Note that if connectToGithubCodeScanning is undefined, it is treated as 'on'. // Force a fetch of the analysis for the current branch. diff --git a/src/extension/index.activateGithubCommands.ts b/src/extension/index.activateGithubCommands.ts index 424000a5..92874cbc 100644 --- a/src/extension/index.activateGithubCommands.ts +++ b/src/extension/index.activateGithubCommands.ts @@ -45,9 +45,9 @@ export function activateGithubCommands(disposables: Disposable[], store: Store, } disposables.push( - commands.registerCommand('sarif.alertDismissFalsePositive', async (context) => dismissAlert(context, 'false positive')), - commands.registerCommand('sarif.alertDismissUsedInTests', async (context) => dismissAlert(context, 'used in tests')), - commands.registerCommand('sarif.alertDismissWontFix', async (context) => dismissAlert(context, 'won\'t fix')), + commands.registerCommand('monokle-sarif.alertDismissFalsePositive', async (context) => dismissAlert(context, 'false positive')), + commands.registerCommand('monokle-sarif.alertDismissUsedInTests', async (context) => dismissAlert(context, 'used in tests')), + commands.registerCommand('monokle-sarif.alertDismissWontFix', async (context) => dismissAlert(context, 'won\'t fix')), ); } diff --git a/src/extension/index.spec.ts b/src/extension/index.spec.ts index ba95fa66..5cd1fcb4 100644 --- a/src/extension/index.spec.ts +++ b/src/extension/index.spec.ts @@ -47,7 +47,7 @@ describe.skip('activate', () => { }); it('can postSelectArtifact', async () => { - await mockVscode.commands.executeCommand('sarif.showPanel'); + await mockVscode.commands.executeCommand('monokle-sarif.showPanel'); const { postSelectArtifact } = proxyquire('../panel/indexStore', { '../panel/isActive': { isActive: () => true, diff --git a/src/extension/index.ts b/src/extension/index.ts index c42f1f3e..620bd290 100644 --- a/src/extension/index.ts +++ b/src/extension/index.ts @@ -41,7 +41,7 @@ export async function activate(context: ExtensionContext): Promise { disposables.push(outputChannel); Store.globalState = context.globalState; - disposables.push(commands.registerCommand('sarif.clearState', () => { + disposables.push(commands.registerCommand('monokle-sarif.clearState', () => { context.globalState.update('view', undefined); commands.executeCommand('workbench.action.reloadWindow'); })); @@ -52,7 +52,7 @@ export async function activate(context: ExtensionContext): Promise { // Panel const panel = new Panel(context, baser, store); - disposables.push(commands.registerCommand('sarif.showPanel', () => panel.show())); + disposables.push(commands.registerCommand('monokle-sarif.showPanel', () => panel.show())); // URI handler disposables.push(window.registerUriHandler({ diff --git a/src/extension/statusBarItem.ts b/src/extension/statusBarItem.ts index a11ccfc6..8709d897 100644 --- a/src/extension/statusBarItem.ts +++ b/src/extension/statusBarItem.ts @@ -17,7 +17,7 @@ export function activateSarifStatusBarItem(disposables: { dispose(): void }[]): statusBarItem = window.createStatusBarItem(StatusBarAlignment.Left); disposables.push(statusBarItem); statusBarItem.text = getStatusText(); - statusBarItem.command = 'sarif.showPanel'; + statusBarItem.command = 'monokle-sarif.showPanel'; statusBarItem.tooltip ='Show SARIF Panel'; statusBarItem.show(); diff --git a/src/extension/update.ts b/src/extension/update.ts index 753ffc3c..d869ef4e 100644 --- a/src/extension/update.ts +++ b/src/extension/update.ts @@ -53,7 +53,7 @@ function getHttpsProxyAgent() { } export const updateChannelConfigSection = 'updateChannel'; -const extensionName = 'sarif-viewer'; +const extensionName = 'monokle-sarif'; let updateInProgress = false; function isUpdateEnabled() { diff --git a/src/extension/uriRebaser.ts b/src/extension/uriRebaser.ts index 734fdc6e..44ee4a0c 100644 --- a/src/extension/uriRebaser.ts +++ b/src/extension/uriRebaser.ts @@ -108,7 +108,7 @@ export class UriRebaser { return this.validatedUrisLocalToArtifact.get(localUri.toString()); } - private extensionName = 'sarif-viewer' + private extensionName = 'monokle-sarif' private trustedSourceSitesConfigSection = 'trustedSourceSites'; private trustedSites = workspace.getConfiguration(this.extensionName).get(this.trustedSourceSitesConfigSection, []); private activeInfoMessages = new Set() // Prevent repeat message animations when arrowing through many results with the same uri.