Skip to content

Commit

Permalink
Fix off by one error
Browse files Browse the repository at this point in the history
  • Loading branch information
riteshnoronha committed Apr 9, 2024
1 parent 2eaa7d6 commit 7f370f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/scorer/ntia.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ func compWithUniqIDCheck(d sbom.Document, c *check) score {
return *s
}

compIDs := lo.Map(d.Components(), func(c sbom.Component, i int) string {
return strings.Join([]string{d.Spec().Namespace(), c.ID()}, "")
compIDs := lo.FilterMap(d.Components(), func(c sbom.Component, i int) (string, bool) {
if c.ID() == "" {
return "", false
}
return strings.Join([]string{d.Spec().Namespace(), c.ID()}, ""), true
})

uniqComps := lo.Uniq(compIDs)
Expand Down

0 comments on commit 7f370f4

Please sign in to comment.