-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12 hover provider for manifest files (#39)
* refactored * Added vulnerabilities data in hover menu * refactored
- Loading branch information
1 parent
c13981f
commit 64814eb
Showing
11 changed files
with
134 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Organization } from "../constants"; | ||
import { DependencyVulnerability } from "types/vulnerability"; | ||
import * as vscode from "vscode"; | ||
|
||
export class Template { | ||
constructor() {} | ||
public licenseContent(data: string, contents: vscode.MarkdownString) { | ||
contents.appendMarkdown(`License: **${data}**`); | ||
contents.appendText("\n______________________________\n"); | ||
} | ||
|
||
public vulnerableContent(data: DependencyVulnerability[], contents: vscode.MarkdownString): void { | ||
if (data.length === 0) { | ||
contents.appendMarkdown("No vulnerabilities found"); | ||
return; | ||
} | ||
|
||
contents.appendMarkdown(`Vulnerabilities Found: **${data.length}**\n\n`); | ||
|
||
const vulnerabilitiesToShow = data.slice(0, 2); | ||
vulnerabilitiesToShow.forEach((vulnerability) => { | ||
contents.appendMarkdown( | ||
`[**${vulnerability.cveId}**](${Organization.debrickedBaseUrl + vulnerability.name.link})`, | ||
); | ||
|
||
if (vulnerability.cvss) { | ||
contents.appendMarkdown(` - CVSS: ${vulnerability.cvss.text} (${vulnerability.cvss.type})`); | ||
} | ||
|
||
contents.appendMarkdown("\n\n"); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ export interface RequestParam { | |
repoId?: number; | ||
endpoint: string; | ||
commitId?: number; | ||
dependencyId?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export interface DependencyVulnerabilityWrapper { | ||
vulnerabilities: DependencyVulnerability[]; | ||
} | ||
|
||
export interface DependencyVulnerability { | ||
cveId: string; | ||
cvss: CVSS; | ||
cpeVersions: string[]; | ||
name: VulnerabilityName | ||
} | ||
|
||
interface CVSS { | ||
text: number; | ||
type: string; | ||
} | ||
|
||
interface VulnerabilityName { | ||
name: string; | ||
link: string; | ||
} |