scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

`fix` with scalafix rules does not respect excluding sources

Open Gedochao opened this issue 3 months ago • 0 comments

Version(s) 1.9.1

Describe the bug The fix sub-command scalafix rules is ignoring whatever is passed with --exclude///> using exclude. Fails complaining about SemanticDB files tied to excluded sources. Everything works fine if only built-in rules are ran.

To Reproduce

//1.scala
//> using options -Wunused:all
//> using dependency org.scalameta::munit::1.1.0
//2.scala
//> using dep com.lihaoyi::utest::0.8.5
object Messages {
  val hello = "hello"
  def function() = {
    val whatever = "whatever"
    hello
  }
}
//project.scala
//> exclude 2.scala
//scalafix.conf
rules  = [
  DisableSyntax
]
scala-cli fix . --power
# Running built-in rules...
# Writing project.scala
# Built-in rules completed.
# Running scalafix rules...
# [hint] ./project.scala:3:22
# [hint] "munit is outdated, update to 1.2.0"
# [hint]      munit 1.1.0 -> org.scalameta::munit::1.2.0
# [hint] //> using dependency org.scalameta::munit::1.1.0
# [hint]                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
# error: SemanticDB not found: 2.scala

Expected behaviour Excluded sources should not influence behaviour of fix.

Gedochao avatar Oct 08 '25 15:10 Gedochao