Skip to content

Commit c13dda6

Browse files
committed
chore(analyzer): Use permalinks in the error for duplicate projects
This makes links valid / clickable to directly inspect the source. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 29183a4 commit c13dda6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

analyzer/src/main/kotlin/AnalyzerResultBuilder.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.ossreviewtoolkit.analyzer
2121

22+
import org.ossreviewtoolkit.downloader.VcsHost
2223
import org.ossreviewtoolkit.model.AnalyzerResult
2324
import org.ossreviewtoolkit.model.DependencyGraph
2425
import org.ossreviewtoolkit.model.DependencyGraphNavigator
@@ -58,12 +59,16 @@ class AnalyzerResultBuilder {
5859
val existingProject = projects.find { it.id == projectAnalyzerResult.project.id }
5960

6061
if (existingProject != null) {
61-
val existingDefinitionFileUrl = existingProject.let {
62-
"${it.vcsProcessed.url}/${it.definitionFilePath}"
62+
val existingDefinitionFileUrl = with(existingProject) {
63+
VcsHost.fromUrl(vcsProcessed.url)
64+
?.toPermalink(vcsProcessed.copy(path = definitionFilePath))
65+
?: "${vcsProcessed.url}/$definitionFilePath"
6366
}
6467

65-
val incomingDefinitionFileUrl = projectAnalyzerResult.project.let {
66-
"${it.vcsProcessed.url}/${it.definitionFilePath}"
68+
val incomingDefinitionFileUrl = with(projectAnalyzerResult.project) {
69+
VcsHost.fromUrl(vcsProcessed.url)
70+
?.toPermalink(vcsProcessed.copy(path = definitionFilePath))
71+
?: "${vcsProcessed.url}/$definitionFilePath"
6772
}
6873

6974
val issue = createAndLogIssue(

0 commit comments

Comments
 (0)