Skip to content

Commit a0667ed

Browse files
committed
test(table): use relationships
Signed-off-by: knqyf263 <[email protected]>
1 parent 5e620b0 commit a0667ed

File tree

2 files changed

+38
-36
lines changed

2 files changed

+38
-36
lines changed

pkg/fanal/types/artifact.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type Package struct {
9595
Modularitylabel string `json:",omitempty"` // only for Red Hat based distributions
9696
BuildInfo *BuildInfo `json:",omitempty"` // only for Red Hat
9797

98-
Indirect bool `json:",omitempty"` // Deprecated: Use relationship
98+
Indirect bool `json:",omitempty"` // Deprecated: Use relationship. Kept for backward compatibility.
9999
Relationship Relationship `json:",omitempty"`
100100

101101
// Dependencies of this package

pkg/report/table/vulnerability_test.go

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -171,38 +171,40 @@ Total: 1 (MEDIUM: 0, HIGH: 1)
171171
Type: "npm",
172172
Packages: []ftypes.Package{
173173
{
174-
175-
Name: "node-fetch",
176-
Version: "1.7.3",
177-
Indirect: true,
174+
175+
Name: "node-fetch",
176+
Version: "1.7.3",
177+
Relationship: ftypes.RelationshipIndirect,
178178
},
179179
{
180-
181-
Name: "isomorphic-fetch",
182-
Version: "2.2.1",
183-
Indirect: true,
180+
181+
Name: "isomorphic-fetch",
182+
Version: "2.2.1",
183+
Relationship: ftypes.RelationshipIndirect,
184184
DependsOn: []string{
185185
186186
},
187187
},
188188
{
189-
190-
Name: "fbjs",
191-
Version: "0.8.18",
192-
Indirect: true,
189+
190+
Name: "fbjs",
191+
Version: "0.8.18",
192+
Relationship: ftypes.RelationshipIndirect,
193193
DependsOn: []string{
194194
195195
},
196196
},
197197
{
198-
199-
Name: "sanitize-html",
200-
Version: "1.20.0",
198+
199+
Name: "sanitize-html",
200+
Version: "1.20.0",
201+
Relationship: ftypes.RelationshipDirect,
201202
},
202203
{
203-
204-
Name: "styled-components",
205-
Version: "3.1.3",
204+
205+
Name: "styled-components",
206+
Version: "3.1.3",
207+
Relationship: ftypes.RelationshipDirect,
206208
DependsOn: []string{
207209
208210
},
@@ -260,41 +262,41 @@ package-lock.json
260262
`,
261263
},
262264
{
263-
name: "happy path with vulnerability origin graph without direct dependency info",
265+
name: "happy path with vulnerability origin graph with unknown relationships",
264266
result: types.Result{
265267
Target: "package-lock.json",
266268
Class: types.ClassLangPkg,
267269
Type: "npm",
268270
Packages: []ftypes.Package{
269271
{
270-
271-
Name: "node-fetch",
272-
Version: "1.7.3",
273-
Indirect: true,
272+
273+
Name: "node-fetch",
274+
Version: "1.7.3",
275+
Relationship: ftypes.RelationshipUnknown,
274276
},
275277
{
276-
277-
Name: "isomorphic-fetch",
278-
Version: "2.2.1",
279-
Indirect: true,
278+
279+
Name: "isomorphic-fetch",
280+
Version: "2.2.1",
281+
Relationship: ftypes.RelationshipUnknown,
280282
DependsOn: []string{
281283
282284
},
283285
},
284286
{
285-
286-
Name: "fbjs",
287-
Version: "0.8.18",
288-
Indirect: true,
287+
288+
Name: "fbjs",
289+
Version: "0.8.18",
290+
Relationship: ftypes.RelationshipUnknown,
289291
DependsOn: []string{
290292
291293
},
292294
},
293295
{
294-
295-
Name: "styled-components",
296-
Version: "3.1.3",
297-
Indirect: true,
296+
297+
Name: "styled-components",
298+
Version: "3.1.3",
299+
Relationship: ftypes.RelationshipUnknown,
298300
DependsOn: []string{
299301
300302
},

0 commit comments

Comments
 (0)