@@ -44,23 +44,23 @@ private val JSON_MAPPER = JsonMapper().apply {
44
44
propertyNamingStrategy = PropertyNamingStrategies .SNAKE_CASE
45
45
}
46
46
47
- private val CONTRIBUTOR_LICENSE_AGREEMENT_IDS = listOf (
48
- " LicenseRef-scancode-cncf-corporate-cla-1.0" ,
49
- " LicenseRef-scancode-cncf-individual-cla-1.0" ,
50
- " LicenseRef-scancode-google-cla" ,
51
- " LicenseRef-scancode-google-corporate-cla" ,
52
- " LicenseRef-scancode-jetty-ccla-1.1" ,
53
- " LicenseRef-scancode-ms-cla" ,
54
- " LicenseRef-scancode-newton-king-cla" ,
55
- " LicenseRef-scancode-owf-cla-1.0-copyright" ,
56
- " LicenseRef-scancode-owf-cla-1.0-copyright-patent" ,
57
- " LicenseRef-scancode-square-cla"
58
- ).map { SpdxSingleLicenseExpression .parse(it) }.toSet()
59
-
60
47
private const val CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT = " contributor-license-agreement"
61
48
private const val CATEGORY_GENERIC = " generic"
62
49
private const val CATEGORY_UNKNOWN = " unknown"
63
50
51
+ private val OVERRIDE_LICENSE_CATEGORIES = mapOf (
52
+ " LicenseRef-scancode-cncf-corporate-cla-1.0" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
53
+ " LicenseRef-scancode-cncf-individual-cla-1.0" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
54
+ " LicenseRef-scancode-google-cla" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
55
+ " LicenseRef-scancode-google-corporate-cla" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
56
+ " LicenseRef-scancode-jetty-ccla-1.1" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
57
+ " LicenseRef-scancode-ms-cla" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
58
+ " LicenseRef-scancode-newton-king-cla" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
59
+ " LicenseRef-scancode-owf-cla-1.0-copyright" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
60
+ " LicenseRef-scancode-owf-cla-1.0-copyright-patent" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT ,
61
+ " LicenseRef-scancode-square-cla" to CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT
62
+ ).mapKeys { (license, _) -> SpdxSingleLicenseExpression .parse(license) }
63
+
64
64
private data class License (
65
65
val licenseKey : String ,
66
66
val spdxLicenseKey : String? = null ,
@@ -150,10 +150,11 @@ private fun LicenseDetails.getLicenseId(): SpdxSingleLicenseExpression {
150
150
}
151
151
152
152
private fun LicenseDetails.getCategories (): Set <String > {
153
+ val overrideLicenseCategory = OVERRIDE_LICENSE_CATEGORIES [getLicenseId()]
153
154
val mappedCategory = when {
154
155
isUnknown -> CATEGORY_UNKNOWN
155
156
isGeneric -> CATEGORY_GENERIC
156
- getLicenseId() in CONTRIBUTOR_LICENSE_AGREEMENT_IDS -> CATEGORY_CONTRIBUTOR_LICENSE_AGREEMENT
157
+ overrideLicenseCategory != null -> overrideLicenseCategory
157
158
else -> category.replace(' ' , ' -' ).lowercase()
158
159
}
159
160
0 commit comments