snyk-cpp-plugin 2.12.4 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { DepGraph } from '@snyk/dep-graph';
|
|
2
|
-
import { DepsFilePaths, Issue, IssuesData, Options, ScanResult, TestResult } from '../types';
|
|
2
|
+
import { DepsFilePaths, Issue, IssuesData, Options, ScanResult, TestResult, FileSignaturesDetails } from '../types';
|
|
3
3
|
export declare function displaySignatures(scanResults: ScanResult[]): string[];
|
|
4
4
|
export declare function selectDisplayStrategy(options: Options | undefined, depGraph: DepGraph, testResult: TestResult): string[][];
|
|
5
|
-
export declare function displayDependencies(depGraph: DepGraph): string[];
|
|
6
|
-
export declare function displayDependenciesWithFilePaths(depGraph: DepGraph, depsFilePaths?: DepsFilePaths): string[];
|
|
5
|
+
export declare function displayDependencies(depGraph: DepGraph, fileSignaturesDetails?: FileSignaturesDetails, depsFilePaths?: DepsFilePaths): string[];
|
|
7
6
|
export declare function displayIssues(depGraph: DepGraph, issues: Issue[], issuesData: IssuesData): string[];
|
|
8
7
|
export declare function displayErrors(errors: string[]): string[];
|
package/dist/display/display.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.displayErrors = exports.displayIssues = exports.
|
|
3
|
+
exports.displayErrors = exports.displayIssues = exports.displayDependencies = exports.selectDisplayStrategy = exports.displaySignatures = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
5
|
const common_1 = require("./common");
|
|
6
|
+
const object_1 = require("../utils/object");
|
|
6
7
|
function displaySignatures(scanResults) {
|
|
7
8
|
const result = [chalk.whiteBright('Signatures')];
|
|
8
9
|
for (const { facts = [] } of scanResults) {
|
|
@@ -20,62 +21,50 @@ function displaySignatures(scanResults) {
|
|
|
20
21
|
return result;
|
|
21
22
|
}
|
|
22
23
|
exports.displaySignatures = displaySignatures;
|
|
23
|
-
function findDependencyLines(depGraph, options, depsFilePaths) {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
return
|
|
24
|
+
function findDependencyLines(depGraph, options, depsFilePaths, fileSignaturesDetails) {
|
|
25
|
+
const displayDepsWithPaths = (options && options['print-dep-paths']) || false;
|
|
26
|
+
const displayDeps = (options && options['print-deps']) || false;
|
|
27
|
+
if (displayDepsWithPaths) {
|
|
28
|
+
return displayDependencies(depGraph, fileSignaturesDetails, depsFilePaths);
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
: [emptyDependencySection];
|
|
30
|
+
else if (displayDeps) {
|
|
31
|
+
return displayDependencies(depGraph, fileSignaturesDetails);
|
|
32
|
+
}
|
|
33
|
+
return [''];
|
|
34
34
|
}
|
|
35
35
|
function selectDisplayStrategy(options, depGraph, testResult) {
|
|
36
|
-
const { depsFilePaths, issues, issuesData } = testResult;
|
|
37
|
-
const dependencySection = findDependencyLines(depGraph, options, depsFilePaths);
|
|
36
|
+
const { depsFilePaths, issues, issuesData, fileSignaturesDetails, } = testResult;
|
|
37
|
+
const dependencySection = findDependencyLines(depGraph, options, depsFilePaths, fileSignaturesDetails);
|
|
38
38
|
const issuesSection = displayIssues(depGraph, issues, issuesData);
|
|
39
39
|
return [dependencySection, issuesSection];
|
|
40
40
|
}
|
|
41
41
|
exports.selectDisplayStrategy = selectDisplayStrategy;
|
|
42
|
-
function displayDependencies(depGraph) {
|
|
43
|
-
const result = [];
|
|
44
|
-
const dependencies = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs();
|
|
45
|
-
const hasDependencies = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0;
|
|
46
|
-
if (!hasDependencies) {
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
result.push(chalk.whiteBright('\nDependencies:\n'));
|
|
50
|
-
for (const { name, version } of dependencies || []) {
|
|
51
|
-
result.push(common_1.leftPad(`${name}@${version}`, 2));
|
|
52
|
-
}
|
|
53
|
-
if (result.length) {
|
|
54
|
-
result.push('');
|
|
55
|
-
}
|
|
56
|
-
return result;
|
|
57
|
-
}
|
|
58
|
-
exports.displayDependencies = displayDependencies;
|
|
59
|
-
function displayDependenciesWithFilePaths(depGraph, depsFilePaths) {
|
|
42
|
+
function displayDependencies(depGraph, fileSignaturesDetails, depsFilePaths = {}) {
|
|
60
43
|
let result = [];
|
|
61
44
|
const dependencies = depGraph === null || depGraph === void 0 ? void 0 : depGraph.getDepPkgs();
|
|
62
45
|
const hasDependencies = (dependencies === null || dependencies === void 0 ? void 0 : dependencies.length) > 0;
|
|
63
46
|
if (!hasDependencies) {
|
|
64
47
|
return result;
|
|
65
48
|
}
|
|
66
|
-
result.push(chalk.whiteBright('\nDependencies
|
|
49
|
+
result.push(chalk.whiteBright('\nDependencies:\n'));
|
|
67
50
|
for (const { name, version } of dependencies) {
|
|
68
51
|
const dependencyId = `${name}@${version}`;
|
|
69
52
|
result.push(`\n${common_1.leftPad(dependencyId, 2)}`);
|
|
70
|
-
if (
|
|
53
|
+
if (fileSignaturesDetails &&
|
|
54
|
+
fileSignaturesDetails[dependencyId].confidence) {
|
|
55
|
+
result.push(common_1.leftPad(`confidence: ${fileSignaturesDetails[dependencyId].confidence.toFixed(3)}`, 2));
|
|
56
|
+
}
|
|
57
|
+
if (!object_1.isEmpty(depsFilePaths)) {
|
|
71
58
|
const displayDepsFilePathsOutput = displayDepsFilePaths(depsFilePaths, dependencyId);
|
|
72
59
|
result = [...result, ...displayDepsFilePathsOutput];
|
|
73
60
|
}
|
|
74
61
|
}
|
|
75
|
-
result.
|
|
62
|
+
if (result.length) {
|
|
63
|
+
result.push('');
|
|
64
|
+
}
|
|
76
65
|
return result;
|
|
77
66
|
}
|
|
78
|
-
exports.
|
|
67
|
+
exports.displayDependencies = displayDependencies;
|
|
79
68
|
function displayDepsFilePaths(depsFilePaths, dependencyId) {
|
|
80
69
|
const maxFilePathsToBeDisplayed = 3;
|
|
81
70
|
const result = [];
|
|
@@ -84,8 +73,7 @@ function displayDepsFilePaths(depsFilePaths, dependencyId) {
|
|
|
84
73
|
for (const filePathToDisplay of filePathsToDisplay) {
|
|
85
74
|
result.push(common_1.leftPad(`- ${filePathToDisplay}`, 4));
|
|
86
75
|
}
|
|
87
|
-
|
|
88
|
-
if (hasToHideAndSayDepsFilePathsCount) {
|
|
76
|
+
if (depsFilePaths[dependencyId].length > 3) {
|
|
89
77
|
result.push(common_1.leftPad(`... and ${depsFilePaths[dependencyId].length -
|
|
90
78
|
maxFilePathsToBeDisplayed} more files`, 4));
|
|
91
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../lib/display/display.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../lib/display/display.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAW/B,qCAAmE;AACnE,4CAA0C;AAE1C,SAAgB,iBAAiB,CAAC,WAAyB;IACzD,MAAM,MAAM,GAAa,CAAC,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3D,KAAK,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,IAAI,WAAW,EAAE;QACxC,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,KAAK,EAAE;YACjC,KAAK,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE;gBACvC,IAAI,IAAI,KAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAA,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;oBACpD,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;iBAC9C;a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Aa,CAAC,MAAgB;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;KACxC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACpB;IACD,IAAI,MAAM,CAAC,MAAM,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACjB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,sCAYC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -64,6 +64,13 @@ export interface TestResult {
|
|
|
64
64
|
issuesData: IssuesData;
|
|
65
65
|
depGraphData: DepGraphData;
|
|
66
66
|
depsFilePaths?: DepsFilePaths;
|
|
67
|
+
fileSignaturesDetails?: FileSignaturesDetails;
|
|
68
|
+
}
|
|
69
|
+
export interface FileSignaturesDetails {
|
|
70
|
+
[pkgKey: string]: {
|
|
71
|
+
confidence: number;
|
|
72
|
+
filePaths: string[];
|
|
73
|
+
};
|
|
67
74
|
}
|
|
68
75
|
export interface SignatureResult {
|
|
69
76
|
path: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isEmpty(obj: Record<string, unknown>): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../lib/utils/object.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAAC,GAA4B;IAClD,OAAO,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;AAC9C,CAAC;AAFD,0BAEC"}
|
package/package.json
CHANGED