mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 23:26:39 -08:00
Add linter check support (#679)
* add linter supports * add only minor version * use latest version * Fix println with format issue * Fix test * Fix tests * For slice with unknown length, preallocating the array * fix code-coverage * Removed linter rules * Reverting linter fixes, adding TODO for later * Ignore linter error for import * Remove another err var. * Ignore shadow error * Fixes * Fix issue * Add back goimports local-prefixes * Update local prefixes * Removed extra spaces and merge the imports * more refactoring * Update photon.go Co-authored-by: Teppei Fukuda <knqyf263@gmail.com>
This commit is contained in:
@@ -3,25 +3,27 @@ package python
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/aquasecurity/trivy-db/pkg/vulnsrc/python"
|
||||
"github.com/aquasecurity/trivy/pkg/types"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"github.com/aquasecurity/trivy-db/pkg/vulnsrc/python"
|
||||
"github.com/aquasecurity/trivy/pkg/scanner/utils"
|
||||
"github.com/aquasecurity/trivy/pkg/types"
|
||||
)
|
||||
|
||||
// Advisory encapsulates the python vulnerability scanner
|
||||
type Advisory struct {
|
||||
vs python.VulnSrc
|
||||
}
|
||||
|
||||
// NewAdvisory is the factory method to reutrn Python Advisory
|
||||
func NewAdvisory() *Advisory {
|
||||
return &Advisory{
|
||||
vs: python.NewVulnSrc(),
|
||||
}
|
||||
}
|
||||
|
||||
// DetectVulnerabilities scans and returns pythin vulnerabilities
|
||||
func (s *Advisory) DetectVulnerabilities(pkgName string, pkgVer *semver.Version) ([]types.DetectedVulnerability, error) {
|
||||
advisories, err := s.vs.Get(pkgName)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user