Skip to content

Commit

Permalink
Update ntia.go
Browse files Browse the repository at this point in the history
Fixed off by one error where when all ID elements are removed there was a 1/n ratio given by SBOMqs instead of the expected 0/n ratio
  • Loading branch information
aidankeefe2022 authored Apr 15, 2024
1 parent b619421 commit f706c77
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/scorer/ntia.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ func compWithUniqIDCheck(d sbom.Document, c *check) score {
return strings.Join([]string{d.Spec().Namespace(), c.ID()}, ""), true
})

uniqComps := lo.Uniq(compIDs)
//uniqComps := lo.Uniq(compIDs)

if totalComponents > 0 {

s.setScore((float64(len(uniqComps)) / float64(totalComponents)) * 10.0)
s.setScore((float64(len(compIDs)) / float64(totalComponents)) * 10.0)
}
s.setDesc(fmt.Sprintf("%d/%d have unique ID's", len(uniqComps), totalComponents))
s.setDesc(fmt.Sprintf("%d/%d have unique ID's", len(compID), totalComponents))
return *s
}

Expand Down

0 comments on commit f706c77

Please sign in to comment.