File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed
Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -154,27 +154,30 @@ abstract class ScanResultsStorage : PackageBasedScanStorage {
154154 if (results.isEmpty()) {
155155 results
156156 } else {
157- val scanResults = results.toMutableList()
157+ val (matchingProvenance, nonMatchingProvenance) = results.partition { it.provenance.matches(pkg) }
158158
159- // Only keep scan results whose provenance information matches the package information.
160- scanResults.retainAll { it.provenance.matches(pkg) }
161- if (scanResults.isEmpty()) {
159+ if (matchingProvenance.isEmpty()) {
162160 logger.debug {
163161 " No stored scan results found for $pkg . The following entries with non-matching provenance " +
164- " have been ignored: ${scanResults .map { it.provenance }} "
162+ " have been ignored: ${nonMatchingProvenance .map { it.provenance }} "
165163 }
164+
165+ matchingProvenance
166166 } else {
167- // Only keep scan results from compatible scanners.
168- scanResults.retainAll { scannerCriteria.matches(it.scanner) }
169- if (scanResults.isEmpty()) {
167+ val (matchingCriteria, nonMatchingCriteria) = matchingProvenance.partition {
168+ scannerCriteria.matches(it.scanner)
169+ }
170+
171+ if (matchingCriteria.isEmpty()) {
170172 logger.debug {
171- " No stored scan results found for $scannerCriteria . The following entries with " +
172- " incompatible scanners have been ignored: ${scanResults.map { it.scanner }} "
173+ " No stored scan results for '${pkg.id.toCoordinates()} ' match $scannerCriteria . The " +
174+ " following entries with non-matching criteria have been ignored: " +
175+ nonMatchingCriteria.map { it.scanner }
173176 }
174177 }
175- }
176178
177- scanResults
179+ matchingCriteria
180+ }
178181 }
179182 }
180183
You can’t perform that action at this time.
0 commit comments