Skip to content

Commit

Permalink
chore(analyzer): Use permalinks in the error for duplicate projects
Browse files Browse the repository at this point in the history
This makes links valid / clickable to directly inspect the source.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 13, 2024
1 parent 29183a4 commit c13dda6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions analyzer/src/main/kotlin/AnalyzerResultBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.ossreviewtoolkit.analyzer

import org.ossreviewtoolkit.downloader.VcsHost
import org.ossreviewtoolkit.model.AnalyzerResult
import org.ossreviewtoolkit.model.DependencyGraph
import org.ossreviewtoolkit.model.DependencyGraphNavigator
Expand Down Expand Up @@ -58,12 +59,16 @@ class AnalyzerResultBuilder {
val existingProject = projects.find { it.id == projectAnalyzerResult.project.id }

if (existingProject != null) {
val existingDefinitionFileUrl = existingProject.let {
"${it.vcsProcessed.url}/${it.definitionFilePath}"
val existingDefinitionFileUrl = with(existingProject) {
VcsHost.fromUrl(vcsProcessed.url)
?.toPermalink(vcsProcessed.copy(path = definitionFilePath))
?: "${vcsProcessed.url}/$definitionFilePath"
}

val incomingDefinitionFileUrl = projectAnalyzerResult.project.let {
"${it.vcsProcessed.url}/${it.definitionFilePath}"
val incomingDefinitionFileUrl = with(projectAnalyzerResult.project) {
VcsHost.fromUrl(vcsProcessed.url)
?.toPermalink(vcsProcessed.copy(path = definitionFilePath))
?: "${vcsProcessed.url}/$definitionFilePath"
}

val issue = createAndLogIssue(
Expand Down

0 comments on commit c13dda6

Please sign in to comment.