Skip to content

Commit

Permalink
refactor: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-snyk committed Mar 27, 2024
1 parent c061471 commit 8c19029
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/snyk/base/statusBarItem/statusBarItem.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as vscode from 'vscode';
import { SNYK_NAME_STATUS } from '../../common/constants/general';
import { SNYK_NAME } from '../../common/constants/general';
import { SNYK_SETTINGS_COMMAND } from '../../common/constants/commands';

export interface IStatusBarItem {
Expand All @@ -11,7 +11,7 @@ class SnykStatusBarItem implements IStatusBarItem {
public snykStatusBarItem: vscode.StatusBarItem;
public constructor() {
this.snykStatusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 0);
this.snykStatusBarItem.text = SNYK_NAME_STATUS;
this.snykStatusBarItem.text = SNYK_NAME;
}

public show(): void {
Expand Down
3 changes: 1 addition & 2 deletions src/snyk/common/constants/general.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Changing this requires changing display name in package.json.
export const SNYK_NAME = 'Snyk Security - Code, Open Source Dependencies, IaC Configurations';
export const SNYK_NAME_STATUS = 'Snyk Security';
export const SNYK_NAME = 'Snyk Security';
export const SNYK_TOKEN_KEY = 'snyk.token';
export const SNYK_UNIQUE_EXTENSION_NAME = 'Snyk Vulnerability Scanner';
export const SNYK_PUBLISHER = 'snyk-security';
Expand Down
8 changes: 0 additions & 8 deletions src/snyk/common/views/issueTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ export abstract class ProductIssueTreeProvider<T> extends AnalysisTreeNodeProvid
);
}

getAIFix(issue: Issue<T>): boolean {
const myIssue = issue as unknown as Issue<CodeIssueData>;
if (myIssue.additionalData.hasAIFix) {
return true;
}
return false;
}

abstract shouldShowTree(): boolean;
abstract filterIssues(issues: Issue<T>[]): Issue<T>[];

Expand Down
4 changes: 0 additions & 4 deletions src/snyk/snykCode/views/issueTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export class IssueTreeProvider extends ProductIssueTreeProvider<CodeIssueData> {
return fixIcon + title;
}

getAIFix(issue: Issue<CodeIssueData>): boolean {
return issue.additionalData.hasAIFix ? true : false;
}

getIssueRange(issue: Issue<CodeIssueData>): Range {
return IssueUtils.createVsCodeRange(issue.additionalData, this.languages);
}
Expand Down
11 changes: 3 additions & 8 deletions src/snyk/snykCode/views/securityIssueTreeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,10 @@ export default class CodeSecurityIssueTreeProvider extends IssueTreeProvider {
}

protected getIssueFoundText(nIssues: number): string {
// return `Snyk found ${!nIssues ? 'no vulnerabilities! ✅' : `${nIssues} ${nIssues === 1 ? 'vulnerability' : 'vulnerabilities'}`
// }`;
let message = "";

if (nIssues <= 0) {
message = '✅ Congrats! No vulnerabilities found!';
if (nIssues > 0) {
return nIssues === 1 ? `${nIssues} vulnerability found by Snyk` : `✋ ${nIssues} vulnerabilities found by Snyk`;
} else {
message = nIssues === 1 ? `${nIssues} vulnerability found by Snyk` : `✋ ${nIssues} vulnerabilities found by Snyk`;
return '✅ Congrats! No vulnerabilities found!';
}
return message;
}
}

0 comments on commit 8c19029

Please sign in to comment.