MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / spdxDoc

Function spdxDoc

cmd/format/spdx.go:30–57  ·  view source on GitHub ↗
(report Report)

Source from the content-addressed store, hash-verified

28}
29
30func spdxDoc(report Report) *model.SpdxDocument {
31
32 doc := model.NewSpdxDocument(report.TaskInfo.AppName)
33
34 report.DepDetailGraph.ForEach(func(n *detail.DepDetailGraph) bool {
35
36 if n.Name == "" {
37 return true
38 }
39
40 lics := []string{}
41 for _, lic := range n.Licenses {
42 lics = append(lics, lic.ShortName)
43 }
44 doc.AddPackage(n.ID, n.Vendor, n.Name, n.Version, model.Language(n.Language), lics)
45
46 for _, c := range n.Children {
47 if c.Name == "" {
48 continue
49 }
50 doc.AddRelation(n.ID, c.ID)
51 }
52
53 return true
54 })
55
56 return doc
57}

Callers 3

SpdxFunction · 0.85
SpdxJsonFunction · 0.85
SpdxXmlFunction · 0.85

Calls 5

AddPackageMethod · 0.95
AddRelationMethod · 0.95
NewSpdxDocumentFunction · 0.92
LanguageTypeAlias · 0.92
ForEachMethod · 0.45

Tested by

no test coverage detected