Skip to content

Commit

Permalink
refactor: rename to 'monokle-sarif'
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Nov 29, 2023
1 parent d15a3a6 commit a0fed47
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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": [
Expand All @@ -61,7 +61,7 @@
],
"default": "off"
},
"sarif-viewer.updateChannel": {
"monokle-sarif.updateChannel": {
"description": "Specifies the type of updates the extension receives.",
"type": "string",
"enum": [
Expand All @@ -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,
Expand All @@ -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'"
}
]
Expand Down
6 changes: 3 additions & 3 deletions src/extension/index.activateFixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export function activateFixes(disposables: Disposable[], store: Pick<Store, 'ana
new ResultQuickFix(diagnostic, result), // Mark as fixed
...result.fixes?.map(fix => 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'),
],
];
},
Expand Down
16 changes: 8 additions & 8 deletions src/extension/index.activateGithubAnalyses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>('connectToGithubCodeScanning');
if (!e.affectsConfiguration('monokle-sarif.connectToGithubCodeScanning')) return;
const connectToGithubCodeScanning = workspace.getConfiguration('monokle-sarif').get<ConnectToGithubCodeScanning>('connectToGithubCodeScanning');
sendGithubConfig(connectToGithubCodeScanning ?? 'undefined');
}));

// See configurations comments at the bottom of this file.
const fullCodeScanningAlert = workspace.getConfiguration('sarif-viewer').get<string>('githubCodeScanningInitialAlert');
const fullCodeScanningAlert = workspace.getConfiguration('monokle-sarif').get<string>('githubCodeScanningInitialAlert');
const connectToGithubCodeScanning: ConnectToGithubCodeScanning = fullCodeScanningAlert
? 'injected'
: workspace.getConfiguration('sarif-viewer').get<ConnectToGithubCodeScanning>('connectToGithubCodeScanning');
: workspace.getConfiguration('monokle-sarif').get<ConnectToGithubCodeScanning>('connectToGithubCodeScanning');
outputChannel.appendLine(`Connect to GitHub Code Scanning: ${connectToGithubCodeScanning}.`);
if (connectToGithubCodeScanning === 'off') {
return;
Expand Down Expand Up @@ -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<boolean>({ location: ProgressLocation.Notification }, async progress => {
progress.report({ increment: 20 }); // 20 is arbitrary as we have a non-deterministic number of steps.
Expand All @@ -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);
Expand All @@ -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');
Expand All @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/extension/index.activateGithubCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/extension/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/extension/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function activate(context: ExtensionContext): Promise<Api> {
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');
}));
Expand All @@ -52,7 +52,7 @@ export async function activate(context: ExtensionContext): Promise<Api> {

// 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({
Expand Down
2 changes: 1 addition & 1 deletion src/extension/statusBarItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/extension/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function getHttpsProxyAgent() {
}

export const updateChannelConfigSection = 'updateChannel';
const extensionName = 'sarif-viewer';
const extensionName = 'monokle-sarif';
let updateInProgress = false;

function isUpdateEnabled() {
Expand Down
2 changes: 1 addition & 1 deletion src/extension/uriRebaser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string[]>(this.trustedSourceSitesConfigSection, []);
private activeInfoMessages = new Set<string>() // Prevent repeat message animations when arrowing through many results with the same uri.
Expand Down

0 comments on commit a0fed47

Please sign in to comment.