Skip to content

Commit

Permalink
fix(fossid-webapp): Remove unecessary call to normalize
Browse files Browse the repository at this point in the history
This call was needed because of the bug fixed by [1]. Therefore, it can now
be removed. A test is also added that checks this behavior.

[1]: #8447

Signed-off-by: Nicolas Nobelis <[email protected]>
  • Loading branch information
nnobelis committed Apr 8, 2024
1 parent f1623e8 commit 29f5236
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ internal fun mapSnippetFindings(
val ortSnippetLocation = snippetLocation ?: TextLocation(snippet.file, TextLocation.UNKNOWN_LINE)

val license = snippet.artifactLicense?.let { artifactLicense ->
mapLicense(artifactLicense, ortSnippetLocation, issues, detectedLicenseMapping)?.license?.normalize()
mapLicense(artifactLicense, ortSnippetLocation, issues, detectedLicenseMapping)?.license
} ?: SpdxConstants.NOASSERTION.toSpdx()

val ortSnippet = OrtSnippet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ class FossIdLicenseMappingTest : WordSpec({
}
}

"map deprecated SPDX FossId licenses in a snippet to snippet findings" {
val rawResults = createSnippet("GFDL-1.2")
val issues = mutableListOf<Issue>()

val findings = mapSnippetFindings(rawResults, issues, emptyMap(), emptyList(), mutableSetOf())

issues should beEmpty()
findings should haveSize(1)
findings.first() shouldNotBeNull {
snippets.first() shouldNotBeNull {
licenses.toString() shouldBe "GFDL-1.2-only"
}
}
}

"map SPDX compliant FossId licenses in a snippet to snippet findings" {
val rawResults = createSnippet("Apache-2.0")
val issues = mutableListOf<Issue>()
Expand Down

0 comments on commit 29f5236

Please sign in to comment.