Skip to content

Commit 512ec6b

Browse files
committed
refactor(Analyzer): Always pass vcs.normalize() to Repository
Signed-off-by: Jens Keim <[email protected]>
1 parent c07f117 commit 512ec6b

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

analyzer/src/main/kotlin/Analyzer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class Analyzer(private val config: AnalyzerConfiguration, private val labels: Ma
155155
} else {
156156
Repository(
157157
provenance = RepositoryProvenance(
158-
vcsInfo = vcs,
158+
vcsInfo = vcs.normalize(),
159159
resolvedRevision = vcs.revision
160160
),
161161
nestedRepositories = nestedVcs,

cli-helper/src/main/kotlin/utils/Extensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ internal fun OrtResult.getScanResultFor(packageConfiguration: PackageConfigurati
716716
* tree.
717717
*/
718718
internal fun OrtResult.getRepositoryPaths(): Map<String, Set<String>> {
719-
val result = mutableMapOf(repository.provenance.vcsInfo.normalize().url to mutableSetOf(""))
719+
val result = mutableMapOf(repository.provenance.vcsInfo.url to mutableSetOf(""))
720720

721721
repository.nestedRepositories.mapValues { (path, vcsInfo) ->
722722
result.getOrPut(vcsInfo.url) { mutableSetOf() } += path

evaluator/src/main/kotlin/ProjectSourceRule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ open class ProjectSourceRule(
9393
/**
9494
* Return the [VcsType] of the project's code repository.
9595
*/
96-
fun projectSourceGetVcsType(): VcsType = ortResult.repository.provenance.vcsInfo.normalize().type
96+
fun projectSourceGetVcsType(): VcsType = ortResult.repository.provenance.vcsInfo.type
9797

9898
/**
9999
* Return the file paths matching any of the given [glob expressions][patterns] with its file content matching

evaluator/src/main/kotlin/RuleSet.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fun ruleSet(
159159
licenseInfoResolver: LicenseInfoResolver = ortResult.createLicenseInfoResolver(),
160160
resolutionProvider: ResolutionProvider = DefaultResolutionProvider.create(),
161161
projectSourceResolver: SourceTreeResolver = SourceTreeResolver.forRemoteRepository(
162-
ortResult.repository.provenance.vcsInfo.normalize()
162+
ortResult.repository.provenance.vcsInfo
163163
),
164164
configure: RuleSet.() -> Unit = {}
165165
) = RuleSet(ortResult, licenseInfoResolver, resolutionProvider, projectSourceResolver).apply(configure)

model/src/main/kotlin/Repository.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ data class Repository(
7676

7777
val normalizedVcs = vcs.normalize()
7878

79-
if (provenance.vcsInfo.normalize().matches(normalizedVcs)) return ""
79+
if (provenance.vcsInfo.matches(normalizedVcs)) return ""
8080

8181
return nestedRepositories.entries.find { (_, nestedVcs) -> nestedVcs.normalize().matches(normalizedVcs) }?.key
8282
}
@@ -95,7 +95,7 @@ private class RepositoryDeserializer : StdDeserializer<Repository>(Repository::c
9595
val vcsProcess = jsonMapper.treeToValue<VcsInfo>(node["vcs_processed"])
9696

9797
// Fall back to [vcsProcessed], if [vcs] is empty.
98-
val vcsInfo = if (vcs != VcsInfo.EMPTY) vcs else vcsProcess
98+
val vcsInfo = vcsProcess
9999

100100
// Get the [vcs]'s revision.
101101
// Fall back to [vcsProcessed], if [vcs] has empty revision.

plugins/reporters/cyclonedx/src/main/kotlin/CycloneDxReporter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class CycloneDxReporter(
154154
// There is no component type for repositories.
155155
type = Component.Type.FILE
156156

157-
with(input.ortResult.repository.provenance.vcsInfo.normalize()) {
157+
with(input.ortResult.repository.provenance.vcsInfo) {
158158
bomRef = "$url@$revision"
159159

160160
name = url
@@ -178,7 +178,7 @@ class CycloneDxReporter(
178178
// distributable), just create a single BOM for all projects in that case for now. As there also is no
179179
// single correct project to pick for adding external references in that case, simply only use the global
180180
// repository VCS information here.
181-
val vcs = input.ortResult.repository.provenance.vcsInfo.normalize()
181+
val vcs = input.ortResult.repository.provenance.vcsInfo
182182
bom.addExternalReference(
183183
ExternalReference.Type.VCS,
184184
vcs.url,

plugins/reporters/static-html/src/main/kotlin/TablesReportModelMapper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal object TablesReportModelMapper {
4848
.sortedBy { it.id }
4949

5050
return TablesReport(
51-
input.ortResult.repository.provenance.vcsInfo.normalize(),
51+
input.ortResult.repository.provenance.vcsInfo,
5252
input.ortResult.repository.config,
5353
ruleViolations,
5454
getAnalyzerIssueSummaryTable(input),

0 commit comments

Comments
 (0)