Skip to content

Commit

Permalink
Do not log empty line when unused warnings are not logged (#296)
Browse files Browse the repository at this point in the history
* Do not log empty line when unused warnings are not logged

* Apply suggestions from code review

---------

Co-authored-by: Jake Wharton <github@jakewharton.com>
  • Loading branch information
remcomokveld and JakeWharton authored Feb 12, 2024
1 parent 4424b26 commit 775827c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/kotlin/app/cash/licensee/task.kt
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ abstract class LicenseeTask : DefaultTask() {
if (validationResult.configResults.isNotEmpty() && validationResult.artifactResults.isNotEmpty()) {
validationReport.appendLine()
// We know these are always at warning or error level, so use lifecycle for space.
logger.log(lifecycleLevel, "")
if (unusedWarningLevel > INFO || unusedErrorLevel > INFO || logger.isInfoEnabled) {
logger.log(lifecycleLevel, "")
}
}
for ((artifactDetail, results) in validationResult.artifactResults) {
val coordinateHeader = buildString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class LicenseePluginFixtureTest {
|WARNING: Allowed .*? is unused
""".trimMargin(),
)
assertThat(result.output).doesNotContain("\n\n> Task :licensee")
}

@Test fun unusedWarn(
Expand Down

0 comments on commit 775827c

Please sign in to comment.