From 0eec03c35906e215fdb804304674d37c1b10b348 Mon Sep 17 00:00:00 2001 From: Edward Samson Date: Tue, 25 Jun 2024 11:02:32 +0800 Subject: [PATCH] Fix exit code policy Aligning expectation that "all repos succeed" means there are no repos with failures. This brings back the old behavior from RunResults: if (reposWithFailures.isEmpty) ExitCode.Success else ExitCode.Error See: https://github.com/scala-steward-org/scala-steward/compare/6259adb0...9d9460af --- .../org/scalasteward/core/application/ExitCodePolicy.scala | 2 +- .../org/scalasteward/core/application/StewardAlgTest.scala | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/core/src/main/scala/org/scalasteward/core/application/ExitCodePolicy.scala b/modules/core/src/main/scala/org/scalasteward/core/application/ExitCodePolicy.scala index 9edcf1a7f2..7150b58a93 100644 --- a/modules/core/src/main/scala/org/scalasteward/core/application/ExitCodePolicy.scala +++ b/modules/core/src/main/scala/org/scalasteward/core/application/ExitCodePolicy.scala @@ -28,5 +28,5 @@ object ExitCodePolicy { val SuccessIfAnyRepoSucceeds: ExitCodePolicy = successIf(_.successRepos.nonEmpty) - val SuccessOnlyIfAllReposSucceed: ExitCodePolicy = successIf(_.reposWithFailures.nonEmpty) + val SuccessOnlyIfAllReposSucceed: ExitCodePolicy = successIf(_.reposWithFailures.isEmpty) } diff --git a/modules/core/src/test/scala/org/scalasteward/core/application/StewardAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/application/StewardAlgTest.scala index 72a194e713..1e686cac1d 100644 --- a/modules/core/src/test/scala/org/scalasteward/core/application/StewardAlgTest.scala +++ b/modules/core/src/test/scala/org/scalasteward/core/application/StewardAlgTest.scala @@ -8,9 +8,6 @@ import org.scalasteward.core.mock.{MockConfig, MockState} class StewardAlgTest extends CatsEffectSuite { test("runF") { val exitCode = stewardAlg.runF.runA(MockState.empty.addUris(MockConfig.reposFile -> "")) - assertIO( - exitCode, - ExitCode.Error - ) // We have not passed any repos to Scala Steward therefore it's reasonable that it will return error code. + assertIO(exitCode, ExitCode.Success) } }