Skip to content

Commit ec75351

Browse files
committed
Ensure fix sub-command respects --test
1 parent 653b2f1 commit ec75351

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

modules/cli/src/main/scala/scala/cli/commands/fix/ScalafixRules.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,21 @@ object ScalafixRules extends CommandHelpers {
6060
buildOptions.scalaParams.orExit(logger).map(_.scalaVersion)
6161
.getOrElse(Constants.defaultScalaVersion)
6262

63+
val shouldBuildTestScope = sharedOptions.scope.test.getOrElse(true)
64+
if !shouldBuildTestScope then
65+
logger.message(
66+
s"""$warnPrefix Building test scope was explicitly disabled.
67+
|$warnPrefix Some scalafix rules may not work correctly with test scope inputs."""
68+
.stripMargin
69+
)
6370
val res = Build.build(
6471
inputs,
6572
buildOptionsWithSemanticDb,
6673
compilerMaker,
6774
None,
6875
logger,
6976
crossBuilds = false,
70-
buildTests = true,
77+
buildTests = shouldBuildTestScope,
7178
partial = None,
7279
actionableDiagnostics = actionableDiagnostics
7380
)

0 commit comments

Comments
 (0)