Skip to content

Commit

Permalink
evaluator: Rename errorSource() to issueSource()
Browse files Browse the repository at this point in the history
Because the helper function is used for creating issues independent of
the severity.

Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@here.com>
  • Loading branch information
mnonnenmacher committed May 3, 2019
1 parent f1a5973 commit 18d3a4f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion evaluator/src/main/kotlin/DependencyRule.kt
Expand Up @@ -67,7 +67,7 @@ class DependencyRule(
"Evaluating rule '$name' for dependency '${dependency.id.toCoordinates()}' " +
"(project=${project.id.toCoordinates()}, scope=${scope.name}, level=$level)."

override fun errorSource() =
override fun issueSource() =
"$name - ${pkg.id.toCoordinates()} (dependency of ${project.id.toCoordinates()} in scope ${scope.name})"

/**
Expand Down
4 changes: 2 additions & 2 deletions evaluator/src/main/kotlin/PackageRule.kt
Expand Up @@ -47,7 +47,7 @@ open class PackageRule(

override val description = "Evaluating rule '$name' for package '${pkg.id.toCoordinates()}'."

override fun errorSource() = "$name - ${pkg.id.toCoordinates()}"
override fun issueSource() = "$name - ${pkg.id.toCoordinates()}"

override fun runInternal() {
licenseRules.forEach { it.evaluate() }
Expand Down Expand Up @@ -149,7 +149,7 @@ open class PackageRule(

override val description = "\tEvaluating license rule '$name' for $licenseSource license '$license'."

override fun errorSource() = "$name - $license ($licenseSource)"
override fun issueSource() = "$name - $license ($licenseSource)"

/**
* A [RuleMatcher] that checks if the [license] is a valid [SpdxLicense].
Expand Down
8 changes: 4 additions & 4 deletions evaluator/src/main/kotlin/Rule.kt
Expand Up @@ -100,27 +100,27 @@ abstract class Rule(
/**
* Return a string to be used as [source][OrtIssue.source] for issues generated in [hint], [warning], and [error].
*/
abstract fun errorSource(): String
abstract fun issueSource(): String

/**
* Add a [hint][Severity.HINT] to the list of [issues].
*/
fun hint(message: String) {
issues += OrtIssue(source = errorSource(), severity = Severity.HINT, message = message)
issues += OrtIssue(source = issueSource(), severity = Severity.HINT, message = message)
}

/**
* Add a [warning][Severity.WARNING] to the list of [issues].
*/
fun warning(message: String) {
issues += OrtIssue(source = errorSource(), severity = Severity.WARNING, message = message)
issues += OrtIssue(source = issueSource(), severity = Severity.WARNING, message = message)
}

/**
* Add an [error][Severity.ERROR] to the list of [issues].
*/
fun error(message: String) {
issues += OrtIssue(source = errorSource(), severity = Severity.ERROR, message = message)
issues += OrtIssue(source = issueSource(), severity = Severity.ERROR, message = message)
}

/**
Expand Down

0 comments on commit 18d3a4f

Please sign in to comment.