Skip to content

Commit

Permalink
chore(commands): Only show once where the results has been written to
Browse files Browse the repository at this point in the history
Deduplicate a bit of console output when running with `--info`.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Apr 16, 2024
1 parent 27c2ce8 commit 2eb0151
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/src/funTest/kotlin/OrtMainFunTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class OrtMainFunTest : StringSpec() {
)

val stdout = result.stdout.lineSequence()
val lines = stdout.filter { it.startsWith("Writing analyzer result to ") }
val lines = stdout.filter { it.startsWith("Wrote analyzer result to ") }

withClue(result.stderr) {
lines.count() shouldBe 2
Expand Down
4 changes: 1 addition & 3 deletions plugins/commands/api/src/main/kotlin/utils/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ fun readOrtResult(ortFile: File): OrtResult {
fun writeOrtResult(ortResult: OrtResult, outputFiles: Collection<File>, terminal: Terminal) {
outputFiles.forEach { file ->
val resultName = file.name.substringBefore('-')
terminal.println("Writing $resultName result to '$file'.")

val duration = measureTime { file.writeValue(ortResult) }

logger.info { "Wrote ORT result to '${file.name}' (${file.formatSizeInMib}) in $duration." }
terminal.println("Wrote $resultName result to '$file' (${file.formatSizeInMib}) in $duration.")

logger.debug { "Output ORT result file has SHA-1 hash ${HashAlgorithm.SHA1.calculate(file)}." }
}
Expand Down

0 comments on commit 2eb0151

Please sign in to comment.