Class Rule
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classRule.RuleMatcherManagerA DSL helper class, providing convenience functions for adding RuleMatchers to this rule.
-
Field Summary
Fields Modifier and Type Field Description private final List<RuleMatcher>matchersprivate final List<RuleViolation>violationsprivate final Stringdescriptionprivate final RuleSetruleSetprivate final Stringname
-
Method Summary
Modifier and Type Method Description final List<RuleMatcher>getMatchers()The list of all matchers that need to match for this rule to apply. final List<RuleViolation>getViolations()The list of all issues created by this rule. abstract StringgetDescription()Return a human-readable description of this rule. final RuleSetgetRuleSet()The RuleSet this rule belongs to. final StringgetName()The name of this rule. final Unitevaluate()Evaluate this rule by checking if all matchers apply. UnitrunInternal()Can be overridden to implement custom behavior, executed if a rule matches. final Unitrequire(Function1<Rule.RuleMatcherManager, Unit> block)DSL function to configure RuleMatchers using a RuleMatcherManager. final RuleMatcherhasLabel(String label, String value, Boolean splitValue)A RuleMatcher that checks whether a label exists in the ORT result. abstract StringissueSource()Return a string to be used as source for issues generated in hint, warning, and error. final Unitissue(Severity severity, Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)Add an issue of the given severity for pkgId to the list of violations. final Unithint(Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)Add a hint to the list of violations. final Unitwarning(Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)Add a warning to the list of violations. final Uniterror(Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)Add an error to the list of violations. -
-
Method Detail
-
getMatchers
final List<RuleMatcher> getMatchers()
The list of all matchers that need to match for this rule to apply.
-
getViolations
final List<RuleViolation> getViolations()
The list of all issues created by this rule.
-
getDescription
abstract String getDescription()
Return a human-readable description of this rule.
-
getRuleSet
final RuleSet getRuleSet()
The RuleSet this rule belongs to.
-
evaluate
final Unit evaluate()
Evaluate this rule by checking if all matchers apply. If this is the case all violations configured in this rule are added to the ruleSet. To add custom behavior if the rule matches override runInternal.
-
runInternal
Unit runInternal()
Can be overridden to implement custom behavior, executed if a rule matches.
-
require
final Unit require(Function1<Rule.RuleMatcherManager, Unit> block)
DSL function to configure RuleMatchers using a RuleMatcherManager.
-
hasLabel
final RuleMatcher hasLabel(String label, String value, Boolean splitValue)
A RuleMatcher that checks whether a label exists in the ORT result. If value is null the value of the label is ignored. If splitValue is true, the label value is interpreted as comma-separated list.
-
issueSource
abstract String issueSource()
-
issue
final Unit issue(Severity severity, Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)
Add an issue of the given severity for pkgId to the list of violations. Optionally, the offending license and its source can be specified. The message further explains the violation itself and howToFix explains how it can be fixed.
-
hint
final Unit hint(Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)
Add a hint to the list of violations.
-
warning
final Unit warning(Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)
Add a warning to the list of violations.
-
error
final Unit error(Identifier pkgId, SpdxSingleLicenseExpression license, LicenseSource licenseSource, String message, String howToFix)
Add an error to the list of violations.
-
-
-
-