From 64d166f5eaa025f85f06a2a5c4916d4824fd34bc Mon Sep 17 00:00:00 2001 From: OliverO2 Date: Sun, 1 Mar 2026 23:47:27 +0100 Subject: [PATCH] Enable unused return value checker --- .../src/main/kotlin/BuildLogicKotlinJvmPlugin.kt | 3 ++- .../kotlin/BuildLogicKotlinMultiplatformPlugin.kt | 3 ++- .../testBalloon/framework/core/TestSuiteScope.kt | 11 +++++++++-- .../framework/core/internal/TestFramework.kt | 4 +++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/build-logic/src/main/kotlin/BuildLogicKotlinJvmPlugin.kt b/build-logic/src/main/kotlin/BuildLogicKotlinJvmPlugin.kt index 35f630a6..17e4b618 100644 --- a/build-logic/src/main/kotlin/BuildLogicKotlinJvmPlugin.kt +++ b/build-logic/src/main/kotlin/BuildLogicKotlinJvmPlugin.kt @@ -14,7 +14,8 @@ class BuildLogicKotlinJvmPlugin : Plugin { compilerOptions { // WORKAROUND: Disable until KLIB resolver warnings can be suppressed or no longer appear. // See also: https://youtrack.jetbrains.com/issue/KT-78277 - // freeCompilerArgs.addAll("-Werror") + // freeCompilerArgs.add("-Werror") + freeCompilerArgs.addAll("-Xreturn-value-checker=full", "-XXLanguage:+UnnamedLocalVariables") } } } diff --git a/build-logic/src/main/kotlin/BuildLogicKotlinMultiplatformPlugin.kt b/build-logic/src/main/kotlin/BuildLogicKotlinMultiplatformPlugin.kt index a6828cef..93aaf774 100644 --- a/build-logic/src/main/kotlin/BuildLogicKotlinMultiplatformPlugin.kt +++ b/build-logic/src/main/kotlin/BuildLogicKotlinMultiplatformPlugin.kt @@ -18,7 +18,8 @@ class BuildLogicKotlinMultiplatformPlugin : Plugin { kotlin.compilerOptions { // WORKAROUND: Disable until KLIB resolver warnings can be suppressed or no longer appear. // See also: https://youtrack.jetbrains.com/issue/KT-78277 - // freeCompilerArgs.addAll("-Werror") + // freeCompilerArgs.add("-Werror") + freeCompilerArgs.addAll("-Xreturn-value-checker=full", "-XXLanguage:+UnnamedLocalVariables") } } } diff --git a/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/TestSuiteScope.kt b/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/TestSuiteScope.kt index 1e5a598b..b44f585f 100644 --- a/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/TestSuiteScope.kt +++ b/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/TestSuiteScope.kt @@ -27,7 +27,14 @@ public interface TestSuiteScope { testConfig: TestConfig = TestConfig, content: TestSuite.() -> Unit ) { - TestSuite(testSuiteInScope, name = name, displayName = displayName, testConfig = testConfig, content = content) + val _ = + TestSuite( + testSuiteInScope, + name = name, + displayName = displayName, + testConfig = testConfig, + content = content + ) } /** @@ -41,7 +48,7 @@ public interface TestSuiteScope { testConfig: TestConfig = TestConfig, action: suspend Test.ExecutionScope.() -> Unit ) { - Test(testSuiteInScope, name = name, displayName = displayName, testConfig = testConfig, action) + val _ = Test(testSuiteInScope, name = name, displayName = displayName, testConfig = testConfig, action) } /** diff --git a/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/internal/TestFramework.kt b/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/internal/TestFramework.kt index d7027282..7c54bb0b 100644 --- a/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/internal/TestFramework.kt +++ b/testBalloon-framework-core/src/commonMain/kotlin/de/infix/testBalloon/framework/core/internal/TestFramework.kt @@ -34,7 +34,9 @@ internal fun initializeTestFramework(testSession: AbstractTestSession? = null, a if (!arguments.isNullOrEmpty()) { argumentsBasedElementSelection = ArgumentsBasedElementSelection(arguments) } - if (testSession == null) TestSession() + if (testSession == null) { + val _ = TestSession() + } } /**