Skip to content
Draft
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
33 changes: 16 additions & 17 deletions evaluator.rules.kts
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ fun RuleSet.commercialInDependencyRule() = packageRule("COMMERCIAL_IN_DEPENDENCY
error(
"The dependency '${pkg.metadata.id.toCoordinates()}' is licensed under the ScanCode 'commercial' " +
"categorized license $license. This requires approval.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand All @@ -1173,16 +1173,15 @@ fun RuleSet.copyleftInDependencyRule() = packageRule("COPYLEFT_IN_DEPENDENCY") {
-isExcluded()
}

licenseRule("COPYLEFT_IN_DEPENDENCY", LicenseView.CONCLUDED_OR_DECLARED_AND_DETECTED) {
licenseRule("COPYLEFT_IN_DEPENDENCY", LicenseView.CONCLUDED_OR_DECLARED_AND_DETECTED, false) {
require {
+isCopyleft()
-isExcluded()
}

error(
"The dependency '${pkg.metadata.id.toCoordinates()}' is licensed under the ScanCode 'copyleft' " +
"categorized license $license.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
"categorized license $license.",""
)
}
}
Expand All @@ -1202,7 +1201,7 @@ fun RuleSet.copyleftLimitedInDependencyRule() = dependencyRule("COPYLEFT_LIMITED
error(
"The dependency '${pkg.metadata.id.toCoordinates()}' is statically linked and licensed under the " +
"ScanCode 'copyleft-limited' categorized license $license.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand All @@ -1220,9 +1219,9 @@ fun RuleSet.copyleftInSourceRule() = packageRule("COPYLEFT_IN_SOURCE") {
}

error(
"The ScanCode 'copyleft' categorized license $license was ${licenseSource.name.lowercase()} in project " +
"The ScanCode 'copyleft' categorized license $license was ${licenseSources.single().name.lowercase()} in project " +
"'${pkg.metadata.id.toCoordinates()}'.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand All @@ -1240,9 +1239,9 @@ fun RuleSet.copyleftLimitedInSourceRule() = packageRule("COPYLEFT_LIMITED_IN_SOU
}

error(
"The ScanCode 'copyleft-limited' categorized license $license was ${licenseSource.name.lowercase()} in " +
"The ScanCode 'copyleft-limited' categorized license $license was ${licenseSources.single().name.lowercase()} in " +
"project '${pkg.metadata.id.toCoordinates()}'.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand Down Expand Up @@ -1297,7 +1296,7 @@ fun RuleSet.freeRestrictedInDependencyRule() = packageRule("FREE_RESTRICTED_IN_D
error(
"The dependency '${pkg.metadata.id.toCoordinates()}' is licensed under the ScanCode 'free-restricted' " +
"categorized license $license. This requires approval.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand All @@ -1319,7 +1318,7 @@ fun RuleSet.genericInDependencyRule() = packageRule("GENERIC_IN_DEPENDENCY") {
"The dependency '${pkg.metadata.id.toCoordinates()}' might contain a license which is unknown to the " +
" tooling. It was detected as $license which is just a trigger, but not a real license. Please " +
"create a dedicated license identifier if the finding is valid.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand Down Expand Up @@ -1459,7 +1458,7 @@ fun RuleSet.patentInDependencyRule() = packageRule("PATENT_IN_DEPENDENCY") {
error(
"The dependency '${pkg.metadata.id.toCoordinates()}' is licensed under the ScanCode 'patent-license' " +
"categorized license $license. This requires approval.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand All @@ -1479,7 +1478,7 @@ fun RuleSet.proprietaryFreeInDependencyRule() = packageRule("PROPRIETARY_FREE_IN
error(
"The dependency '${pkg.metadata.id.toCoordinates()}' is licensed under the ScanCode 'proprietary-free' " +
"categorized license $license. This requires approval.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand All @@ -1501,7 +1500,7 @@ fun RuleSet.unkownInDependencyRule() = packageRule("UNKNOWN_IN_DEPENDENCY") {
"The dependency '${pkg.metadata.id.toCoordinates()}' might contain a license which is unknown to the " +
" tooling. It was detected as $license which is just a trigger, but not a real license. Please " +
"create a dedicated license identifier if the finding is valid.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand All @@ -1521,7 +1520,7 @@ fun RuleSet.unstatedInDependencyRule() = packageRule("UNSTATED_IN_DEPENDENCY") {
error(
"The dependency '${pkg.metadata.id.toCoordinates()}' is licensed under the ScanCode 'unstated-licenses' " +
"categorized license $license. This requires approval.",
howToFixLicenseViolationDefault(license.toString(), licenseSource)
howToFixLicenseViolationDefault(license.toString(), licenseSources.single())
)
}
}
Expand Down Expand Up @@ -1591,9 +1590,9 @@ fun RuleSet.unhandledLicenseRule() = packageRule("UNHANDLED_LICENSE") {

error(
"The license $license is currently not covered by policy rules. " +
"The license was ${licenseSource.name.lowercase()} in package " +
"The license was ${licenseSources.single().name.lowercase()} in package " +
"'${pkg.metadata.id.toCoordinates()}'.",
howToFixUnhandledLicense(license.toString(), licenseSource)
howToFixUnhandledLicense(license.toString(), licenseSources.single())
)
}
}
Expand Down