Skip to content

Commit

Permalink
Fix PURL bug, and fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
another-rex committed Oct 18, 2024
1 parent cf6fc3d commit b6ba7e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions internal/lockfilescalibr/language/java/pomxmlnet/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func (e Extractor) FileRequired(path string, _ fs.FileInfo) bool {

// Extract extracts packages from yarn.lock files passed through the scan input.
func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) ([]*extractor.Inventory, error) {

var project maven.Project
if err := datasource.NewMavenDecoder(input.Reader).Decode(&project); err != nil {
return nil, fmt.Errorf("could not extract from %s: %w", input.Path, err)
Expand Down Expand Up @@ -158,17 +157,17 @@ func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) ([]
// ToPURL converts an inventory created by this extractor into a PURL.
func (e Extractor) ToPURL(i *extractor.Inventory) (*purl.PackageURL, error) {
return &purl.PackageURL{
Type: purl.TypeNPM,
Type: purl.TypeMaven,
Name: i.Name,
Version: i.Version,
}, nil
}

// ToCPEs is not applicable as this extractor does not infer CPEs from the Inventory.
func (e Extractor) ToCPEs(i *extractor.Inventory) ([]string, error) { return []string{}, nil }
func (e Extractor) ToCPEs(_ *extractor.Inventory) ([]string, error) { return []string{}, nil }

// Ecosystem returns the OSV ecosystem ('npm') of the software extracted by this extractor.
func (e Extractor) Ecosystem(i *extractor.Inventory) string {
func (e Extractor) Ecosystem(_ *extractor.Inventory) string {
return "Maven"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,5 +363,4 @@ func TestExtractor_Extract_WithMockServer(t *testing.T) {
if diff := cmp.Diff(tt.WantInventory, got, cmpopts.SortSlices(extracttest.InventoryCmpLess)); diff != "" {
t.Errorf("%s.Extract(%q) diff (-want +got):\n%s", extr.Name(), tt.InputConfig.Path, diff)
}

}

0 comments on commit b6ba7e6

Please sign in to comment.