Skip to content

Commit

Permalink
refactor: Return a set from mergeCopyrightFindings()
Browse files Browse the repository at this point in the history
Returning a sorted set is no more necessary, because `ScanSummary` has
been changed in a preceeding change to use a set for the copyright
findings.

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed May 16, 2023
1 parent 46c7454 commit 79701d0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ data class NestedProvenanceScanResult(
return findings
}

private fun Map<KnownProvenance, List<ScanResult>>.mergeCopyrightFindings(): SortedSet<CopyrightFinding> {
private fun Map<KnownProvenance, List<ScanResult>>.mergeCopyrightFindings(): Set<CopyrightFinding> {
val findingsByPath = mapKeys { getPath(it.key) }.mapValues { (_, scanResults) ->
scanResults.flatMap { it.summary.copyrightFindings }
}

val findings = findingsByPath.flatMapTo(sortedSetOf()) { (path, findings) ->
val findings = findingsByPath.flatMapTo(mutableSetOf()) { (path, findings) ->
val prefix = if (path.isEmpty()) path else "$path/"
findings.map { it.copy(location = it.location.copy(path = "$prefix${it.location.path}")) }
}
Expand Down

0 comments on commit 79701d0

Please sign in to comment.