From 73b2efa2bf8d4bb4a4861b76ffa0ef31a30716e4 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 25 Jan 2024 11:06:34 +0100 Subject: [PATCH] fix(node): Deduplicate issue lines before collapsing them Duplicate lines might confuse the common prefix finder logic. Signed-off-by: Sebastian Schuberth --- .../synthetic/npm-version-urls-expected-output.yml | 8 -------- plugins/package-managers/node/src/main/kotlin/Npm.kt | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/plugins/package-managers/node/src/funTest/assets/projects/synthetic/npm-version-urls-expected-output.yml b/plugins/package-managers/node/src/funTest/assets/projects/synthetic/npm-version-urls-expected-output.yml index a891e2c400fd9..35e0594f6e536 100644 --- a/plugins/package-managers/node/src/funTest/assets/projects/synthetic/npm-version-urls-expected-output.yml +++ b/plugins/package-managers/node/src/funTest/assets/projects/synthetic/npm-version-urls-expected-output.yml @@ -5161,10 +5161,6 @@ issues: source: "NPM" message: "deprecated is-accessor-descriptor@1.0.0: Please upgrade to v1.0.1" severity: "WARNING" -- timestamp: "1970-01-01T00:00:00Z" - source: "NPM" - message: "deprecated is-accessor-descriptor@1.0.0: Please upgrade to v1.0.1" - severity: "WARNING" - timestamp: "1970-01-01T00:00:00Z" source: "NPM" message: "deprecated is-data-descriptor@0.1.4: Please upgrade to v0.1.5" @@ -5173,10 +5169,6 @@ issues: source: "NPM" message: "deprecated is-data-descriptor@1.0.0: Please upgrade to v1.0.1" severity: "WARNING" -- timestamp: "1970-01-01T00:00:00Z" - source: "NPM" - message: "deprecated is-data-descriptor@1.0.0: Please upgrade to v1.0.1" - severity: "WARNING" - timestamp: "1970-01-01T00:00:00Z" source: "NPM" message: "deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported.\ diff --git a/plugins/package-managers/node/src/main/kotlin/Npm.kt b/plugins/package-managers/node/src/main/kotlin/Npm.kt index 36b14f53219c1..007fb5ef06ac1 100644 --- a/plugins/package-managers/node/src/main/kotlin/Npm.kt +++ b/plugins/package-managers/node/src/main/kotlin/Npm.kt @@ -622,7 +622,7 @@ open class Npm( var commonPrefix: String var previousPrefix = "" - val collapsedLines = issueLines.fold(mutableListOf()) { messages, line -> + val collapsedLines = issueLines.distinct().fold(mutableListOf()) { messages, line -> if (messages.isEmpty()) { // The first line is always added including the prefix. The prefix will be removed later. messages += line