MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / coverage

Method coverage

src/licensedcode/detection.py:373–385  ·  view source on GitHub ↗

Return the score for this detection as a rounded float between 0 and 100. This is an indication of the how much this detection covers the rules of the underlying match. This is computed as the sum of the underlying matches coverage weighted by the length of

(self)

Source from the content-addressed store, hash-verified

371 return sum(m.self.rule.length for m in self.matches)
372
373 def coverage(self):
374 """
375 Return the score for this detection as a rounded float between 0 and 100.
376
377 This is an indication of the how much this detection covers the rules of
378 the underlying match.
379
380 This is computed as the sum of the underlying matches coverage weighted
381 by the length of a match to the overall detection length.
382 """
383 length = self.length
384 weighted_coverages = (m.coverage() * (m.len() / length) for m in self.matches)
385 return min([round(sum(weighted_coverages), 2), 100])
386
387 def relevance(self):
388 """

Callers 4

is_correct_detectionFunction · 0.45
is_license_introFunction · 0.45

Calls 2

roundFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected