Skip to content

Commit

Permalink
chore: Removing dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
langecode committed May 2, 2024
1 parent c5c1efc commit 325933f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
17 changes: 1 addition & 16 deletions pkg/controllers/convert.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package controllers

import (
"context"
"fmt"
"net/url"
"sort"
"strings"

Expand All @@ -14,7 +11,7 @@ import (
)

// convertTrivyReport based on https://github.com/openclarity/kubeclarity/blob/main/shared/pkg/scanner/trivy/scanner.go#L285
func convertTrivyReport(ctx context.Context, report *ty.Report) ([]*scanner.MergedVulnerability, error) {
func convertTrivyReport(report *ty.Report) ([]*scanner.MergedVulnerability, error) {
matches := []*scanner.MergedVulnerability{}
for _, result := range report.Results {
for _, vul := range result.Vulnerabilities {
Expand Down Expand Up @@ -71,18 +68,6 @@ func convertTrivyReport(ctx context.Context, report *ty.Report) ([]*scanner.Merg
return matches, nil
}

func getTypeFromPurl(purl string) (string, error) {
u, err := url.Parse(purl)
if err != nil {
return "", fmt.Errorf("unable to parse purl: %w", err)
}
typ, _, found := strings.Cut(u.Opaque, "/")
if !found {
return "", fmt.Errorf("type not found in purl")
}
return typ, nil
}

func getCVSSesFromVul(vCvss trivyDBTypes.VendorCVSS) []scanner.CVSS {
cvsses := []scanner.CVSS{}
v2Collected := false
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/scanjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (r *ScanJobController) processLogStream(ctx context.Context, stream io.Read
return nil, err
}

vuln, _ := convertTrivyReport(ctx, &reports)
vuln, _ := convertTrivyReport(&reports)
marshaller := &cyclonedx.Marshaler{}
bom, _ := marshaller.MarshalReport(ctx, reports)

Expand Down

0 comments on commit 325933f

Please sign in to comment.