Skip to content

Commit 80f72cb

Browse files
committed
feat(evaluator.rules): Flag the use of dependencies without a license
Signed-off-by: Frank Viernau <[email protected]>
1 parent a1925a9 commit 80f72cb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

evaluator.rules.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,19 @@ fun RuleSet.missingTestsRule() = projectSourceRule("MISSING_TESTS") {
13541354
)
13551355
}
13561356

1357+
fun RuleSet.noLicenseInDependencyRule() = dependencyRule("NO_LICENSE_IN_DEPENDENCY") {
1358+
require {
1359+
-hasLicense()
1360+
-isExcluded()
1361+
}
1362+
1363+
error(
1364+
"No license information is available for dependency '${pkg.metadata.id.toCoordinates()}'.",
1365+
"If the dependency indeed is unlicensed, it must not be used. Otherwise, please conclude the appropriate " +
1366+
"license with a package curation."
1367+
)
1368+
}
1369+
13571370
fun RuleSet.packageConfigurationInOrtYmlRule() = ortResultRule("PACKAGE_CONFIGURATION_IN_ORT_YML") {
13581371
if (ortResult.repository.config.packageConfigurations.isNotEmpty()) {
13591372
error(
@@ -1572,6 +1585,7 @@ fun RuleSet.commonRules() {
15721585
packageCurationInOrtYmlRule()
15731586

15741587
// Rules for dependencies:
1588+
noLicenseInDependencyRule()
15751589
vulnerabilityInDependencyRule()
15761590
vulnerabilityWithHighSeverityInDependencyRule()
15771591

0 commit comments

Comments
 (0)