Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions model/src/main/kotlin/utils/PurlExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ fun Identifier.getPurlType(): String =
* Map a PURL type string to the corresponding ORT Identifier type string.
*/
internal fun purlTypeToOrtType(purlType: String): String =
when (purlType) {
when (purlType.lowercase()) {
"cargo" -> "crate"
"cocoapods" -> "pod"
"golang" -> "go"
"maven" -> "Maven"
else -> purlType
}

Expand Down
8 changes: 5 additions & 3 deletions model/src/test/kotlin/utils/PurlExtensionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ class PurlExtensionsTest : WordSpec({

"purlTypeToOrtType()" should {
"return the correct ORT type for known PURL types" {
purlTypeToOrtType("maven") shouldBe "Maven"
purlTypeToOrtType("npm") shouldBe "npm"
purlTypeToOrtType("golang") shouldBe "go"
purlTypeToOrtType("cargo") shouldBe "crate"
purlTypeToOrtType("cocoapods") shouldBe "pod"
purlTypeToOrtType("golang") shouldBe "go"

purlTypeToOrtType("maven") shouldBe "maven"
purlTypeToOrtType("npm") shouldBe "npm"
}

"return the type as-is for unknown PURL types" {
Expand Down
Loading