diff --git a/plugins/commands/compare/src/main/kotlin/CompareCommand.kt b/plugins/commands/compare/src/main/kotlin/CompareCommand.kt index d6b3e16c9d32c..6d7fb8c5b59c4 100644 --- a/plugins/commands/compare/src/main/kotlin/CompareCommand.kt +++ b/plugins/commands/compare/src/main/kotlin/CompareCommand.kt @@ -543,8 +543,8 @@ private fun ScannerRun?.diff(other: ScannerRun?, context: SemanticDiffContext): config = if (context.ignoreConfig) null else config.diff(other.config), provenancesA = (provenances - other.provenances).takeUnless { it.isEmpty() }, provenancesB = (other.provenances - provenances).takeUnless { it.isEmpty() }, - scannersA = scanners.takeIf { it != other.scanners }, - scannersB = other.scanners.takeIf { it != scanners }, + scannersA = scanners.diff(other.scanners).takeUnless { it.isEmpty() }, + scannersB = other.scanners.diff(scanners).takeUnless { it.isEmpty() }, filesA = if (context.ignoreFileList) null else (files - other.files).takeUnless { it.isEmpty() }, filesB = if (context.ignoreFileList) null else (other.files - files).takeUnless { it.isEmpty() }, scanResultDiff = differentResults.takeUnless { it.isEmpty() } @@ -552,6 +552,10 @@ private fun ScannerRun?.diff(other: ScannerRun?, context: SemanticDiffContext): } } +private fun Map>.diff(other: Map>): Map> { + return filter { (id, values) -> other[id] != values } +} + private fun ScannerConfiguration?.diff(other: ScannerConfiguration?): ScannerConfigurationDiff? { if (this == other) return null