Skip to content

Commit

Permalink
refactor(ort-utils): Semantically separate mapping from processing li…
Browse files Browse the repository at this point in the history
…censes

Introduce an intermediate variable to separate these two steps for
clarity and to ease debugging.

Signed-off-by: Sebastian Schuberth <sebastian@doubleopen.org>
  • Loading branch information
sschuberth committed Jun 18, 2024
1 parent 631db0f commit 8d8480b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/ort/src/main/kotlin/DeclaredLicenseProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ object DeclaredLicenseProcessor {
?: SpdxDeclaredLicenseMapping.map(strippedLicense)
?: SpdxDeclaredLicenseMapping.map(strippedLicense.unquote())
?: SpdxDeclaredLicenseMapping.map(strippedLicense.removePrefix(SpdxConstants.TAG).trim())
?: parseLicense(strippedLicense)

return mappedLicense?.normalize()?.takeIf { it.isValid() || it.toString() == SpdxConstants.NONE }
val processedLicense = mappedLicense ?: parseLicense(strippedLicense)
return processedLicense?.normalize()?.takeIf { it.isValid() || it.toString() == SpdxConstants.NONE }
}

/**
Expand Down

0 comments on commit 8d8480b

Please sign in to comment.