refactor(deps): move dependencies to package (#2189)

This commit is contained in:
AndreyLevchenko
2022-06-01 19:09:50 +06:00
committed by GitHub
parent f982167c0a
commit f7d02538f6
6 changed files with 20 additions and 32 deletions

View File

@@ -116,7 +116,7 @@ func (w Writer) Write(report types.Report) error {
githubPkg := Package{}
githubPkg.Scope = RuntimeScope
githubPkg.Relationship = getPkgRelationshipType(pkg)
githubPkg.Dependencies = getDependencies(result, pkg)
githubPkg.Dependencies = pkg.DependsOn
githubPkg.PackageUrl, err = buildPurl(result.Type, pkg)
if err != nil {
return xerrors.Errorf("unable to build purl for %s: %w", pkg.Name, err)
@@ -153,15 +153,6 @@ func getMetadata(report types.Report) Metadata {
return metadata
}
func getDependencies(result types.Result, pkg ftypes.Package) []string {
for _, dep := range result.Dependencies {
if dep.ID == pkg.ID {
return dep.DependsOn
}
}
return []string{}
}
func getPkgRelationshipType(pkg ftypes.Package) string {
if pkg.Indirect {
return IndirectRelationship