Skip to content

Commit

Permalink
refactor(bundler): remove unnecessary code (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
knqyf263 committed Aug 24, 2020
1 parent b2a0d83 commit 827cea3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
19 changes: 0 additions & 19 deletions pkg/detector/library/bundler/advisory.go
Expand Up @@ -11,18 +11,6 @@ import (
"github.com/aquasecurity/trivy/pkg/types"
)

var (
platformReplacer = strings.NewReplacer(
"-java", "+java",
"-mswin32", "+msin32",
"-mswin64", "+mswin64",
"-universal-mingw32", "+universal-mingw32",
"-x64-mingw32", "+x64-mingw32",
"-x86_64-mingw32", "+x86_64-mingw32",
"-mingw32", "+mingw32",
)
)

type VulnSrc interface {
Get(pkgName string) ([]bundlerSrc.Advisory, error)
}
Expand All @@ -31,13 +19,6 @@ type Advisory struct {
vs VulnSrc
}

func massageLockFileVersion(version string) string {
// Move the platform into "metadata" semver section.
// This is because otherwise we end up placing it in the "pre-release" section
// of the semver value, and this breaks our version comparisons in the scanner.
return platformReplacer.Replace(version)
}

func NewAdvisory() *Advisory {
return &Advisory{
vs: bundlerSrc.NewVulnSrc(),
Expand Down
2 changes: 0 additions & 2 deletions pkg/detector/library/bundler/advisory_test.go
Expand Up @@ -52,8 +52,6 @@ func TestScanner_Detect(t *testing.T) {
}

versionStr := "1.9.25-x64-mingw32"
versionStr = platformReplacer.Replace(versionStr)

v, _ := semver.NewVersion(versionStr)

vulns, err := s.DetectVulnerabilities("ffi", v)
Expand Down

0 comments on commit 827cea3

Please sign in to comment.