Skip to content

Gracefully handle Contributor License Agreements #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 17, 2022
Merged
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
2 changes: 2 additions & 0 deletions evaluator-rules/src/main/resources/evaluator.rules.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ val freeRestrictedLicenses = getLicensesForCategory("free-restricted")
val permissiveLicenses = getLicensesForCategory("permissive")
val proprietaryFreeLicenses = getLicensesForCategory("proprietary-free")
val publicDomainLicenses = getLicensesForCategory("public-domain")
val contributorLicenseAgreementLicenenses = getLicensesForCategory("contributor-license-agreement")

/**
* The complete set of licenses covered by policy rules.
Expand All @@ -53,6 +54,7 @@ val publicDomainLicenses = getLicensesForCategory("public-domain")
* policy rules for new (offinding) categories, if any.
*/
val handledLicenses = listOf(
contributorLicenseAgreementLicenenses,
copyleftLicenses,
copyleftLimitedLicenses,
freeRestrictedLicenses,
Expand Down
21 changes: 11 additions & 10 deletions license-classifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
---
categories:
- name: "commercial"
- name: "contributor-license-agreement"
- name: "copyleft"
- name: "copyleft-limited"
- name: "free-restricted"
Expand Down Expand Up @@ -2096,11 +2097,11 @@ categorizations:
- "include-in-notice-file"
- id: "LicenseRef-scancode-cncf-corporate-cla-1.0"
categories:
- "patent-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-cncf-individual-cla-1.0"
categories:
- "patent-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-cockroach"
categories:
Expand Down Expand Up @@ -2859,11 +2860,11 @@ categorizations:
- "include-in-notice-file"
- id: "LicenseRef-scancode-google-cla"
categories:
- "patent-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-google-corporate-cla"
categories:
- "patent-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-google-maps-tos-2018-02-07"
categories:
Expand Down Expand Up @@ -3487,7 +3488,7 @@ categorizations:
- "include-in-notice-file"
- id: "LicenseRef-scancode-jetty-ccla-1.1"
categories:
- "proprietary-free"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-jgraph"
categories:
Expand Down Expand Up @@ -4079,7 +4080,7 @@ categorizations:
- "include-source-code-offer-in-notice-file"
- id: "LicenseRef-scancode-ms-cla"
categories:
- "patent-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-ms-control-spy-2.0"
categories:
Expand Down Expand Up @@ -4490,7 +4491,7 @@ categorizations:
- "include-in-notice-file"
- id: "LicenseRef-scancode-newton-king-cla"
categories:
- "unstated-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-nexb-eula-saas-1.1.0"
categories:
Expand Down Expand Up @@ -4947,11 +4948,11 @@ categorizations:
- "include-in-notice-file"
- id: "LicenseRef-scancode-owf-cla-1.0-copyright"
categories:
- "permissive"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-owf-cla-1.0-copyright-patent"
categories:
- "patent-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-owfa-1.0"
categories:
Expand Down Expand Up @@ -5614,7 +5615,7 @@ categorizations:
- "include-in-notice-file"
- id: "LicenseRef-scancode-square-cla"
categories:
- "patent-license"
- "contributor-license-agreement"
- "include-in-notice-file"
- id: "LicenseRef-scancode-squeak"
categories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ private val JSON_MAPPER = JsonMapper().apply {
propertyNamingStrategy = PropertyNamingStrategies.SNAKE_CASE
}

private val CONTRIBUTOR_LICENSE_AGREEMENT_IDS = listOf(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message nit: "CLA's" > "CLAs"

"LicenseRef-scancode-cncf-corporate-cla-1.0",
"LicenseRef-scancode-cncf-individual-cla-1.0",
"LicenseRef-scancode-google-cla",
"LicenseRef-scancode-google-corporate-cla",
"LicenseRef-scancode-jetty-ccla-1.1",
"LicenseRef-scancode-ms-cla",
"LicenseRef-scancode-newton-king-cla",
"LicenseRef-scancode-owf-cla-1.0-copyright",
"LicenseRef-scancode-owf-cla-1.0-copyright-patent",
"LicenseRef-scancode-square-cla"
).map { SpdxSingleLicenseExpression.parse(it) }.toSet()

private data class License(
val licenseKey: String,
val spdxLicenseKey: String? = null,
Expand Down Expand Up @@ -137,6 +150,7 @@ private fun LicenseDetails.getCategories(): Set<String> {
val mappedCategory = when {
isUnknown -> "unknown"
isGeneric -> "generic"
getLicenseId() in CONTRIBUTOR_LICENSE_AGREEMENT_IDS -> "contributor-license-agreement"
else -> category.replace(' ', '-').toLowerCase()
}

Expand Down