Skip to content

Commit

Permalink
chore(evaluator): Improve echoing of rule violations
Browse files Browse the repository at this point in the history
Print these in a dedicated section before the duration.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Apr 16, 2024
1 parent 2eb0151 commit bf379c7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions plugins/commands/evaluator/src/main/kotlin/EvaluatorCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,19 @@ class EvaluatorCommand : OrtCommand(
val scripts = scriptUris.map { it.toURL().readText() }
val evaluatorRun = evaluator.run(*scripts.toTypedArray())

val duration = with(evaluatorRun) { Duration.between(startTime, endTime).toKotlinDuration() }
echo("The evaluation of ${scriptUris.size} script(s) took $duration.")
if (evaluatorRun.violations.isNotEmpty()) {
echo("The following ${evaluatorRun.violations.size} rule violations have been found:")

evaluatorRun.violations.forEach { violation ->
echo(violation.format())
evaluatorRun.violations.forEach { violation ->
echo(violation.format())
}
} else {
echo("No rule violations have been found.")
}

val duration = with(evaluatorRun) { Duration.between(startTime, endTime).toKotlinDuration() }
echo("The evaluation of ${scriptUris.size} script(s) took $duration.")

// Note: This overwrites any existing EvaluatorRun from the input file.
val ortResultOutput = ortResultInput.copy(evaluator = evaluatorRun)
.mergeLabels(labels)
Expand Down

0 comments on commit bf379c7

Please sign in to comment.