You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How are updates.fileExtensions merged when you specify a default config with --repo-config and a repo also has its own .scala-steward.conf file? I'm trying to write some tests to validate our config files and I want to confirm that I understand the existing behavior (and that the existing behavior is the desired behavior).
This calcuates the intersection of the two lists of extensions. Is the intention that repos can only narrow the set of updatable options?
Ultimately this means the combination of those two config files would result in the equivalent of
updates.fileExtensions = [".bar"]
which I thought was a surprising result. I was expecting either that the repo-specific config file would override the default entirely, or the union of the two lists would be used.
This came up as I tried to write tests validating that our Scala Steward instance's config files are valid, e.g.
privategivenLogger[IO] =Slf4jLogger.getLogger[IO]
privategivenFileAlg[IO] =FileAlg.create
privategivenWorkspaceAlg[IO] = … stub instance …
test("validate this repo's .scala-steward.conf"):valfile=File(".scala-steward.conf")
for
thisRepoResult <-RepoConfigAlg.readRepoConfigFromFile(file)
globalConfig <-RepoConfigAlg.readRepoConfigFromFile(File("default.scala-steward.conf"))
repoConfigAlgInstance =newRepoConfigAlg(globalConfig.maybeRepoConfig)
mergedResult = repoConfigAlgInstance.mergeWithGlobal(thisRepoResult.maybeRepoConfig)
_ <-IO.println(mergedResult)
yield
thisRepoResult.fold(
fail(s"$file does not exist"),
e => fail(s"Config is invalid: $e"),
_ => () // TODO assert exceptions on mergedResult
)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
How are
updates.fileExtensions
merged when you specify a default config with--repo-config
and a repo also has its own.scala-steward.conf
file? I'm trying to write some tests to validate our config files and I want to confirm that I understand the existing behavior (and that the existing behavior is the desired behavior).e.g. the
--repo-config
file hasand the repo
.scala-steward.conf
file hasI assumed the repo's config file would override the defaults as set by
--repo-config
, but it looks likeRepoConfigAlg#mergeWithGlobal
eventually (via the Monoid instance definitions) usesUpdatesConfig$mergeFileExtensions
:scala-steward/modules/core/src/main/scala/org/scalasteward/core/repoconfig/UpdatesConfig.scala
Lines 227 to 231 in 15ff290
This calcuates the intersection of the two lists of extensions. Is the intention that repos can only narrow the set of updatable options?
Ultimately this means the combination of those two config files would result in the equivalent of
which I thought was a surprising result. I was expecting either that the repo-specific config file would override the default entirely, or the union of the two lists would be used.
This came up as I tried to write tests validating that our Scala Steward instance's config files are valid, e.g.
Beta Was this translation helpful? Give feedback.
All reactions