scalafix-organize-imports
scalafix-organize-imports copied to clipboard
Running from sbt command line without full depency spec produces inconsistent results
I haven't had success digging into why, but if I run:
-
sbt "scalafix dependency:[email protected]:organize-imports:0.6.0 [--check]"
(with or without--check
) it works every time -
sbt "scalafix"
will work some of the time, otherwise exit without doing anything -
sbt "scalafix --check"
never works -
sbt "scalafix OrganizeImports"
also never works
This is with .scalafix.conf
:
rules = [OrganizeImports]
OrganizeImports {
preset = INTELLIJ_2020_3
}
and ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.6.0"
in build.sbt
.
I'd expect running without explicitly specifying the full dependency on the command line should work. It might be some incompatibility between scalafix-0.10 or if somehow the default rule/action for this library is something different than "OrganizeImports".
I've determined that at least some instances of non-working are due to aggressive state-caching, wherein once a file has been "fixed", the file will be ignored thereafter, even if changes are reverted from git. Removing all files/directoriest under target with "scalafix" in their name clears this state.
This looks like a problem with the sbt-scalafix cache indeed. I haven't been able to reproduce the issue, but if you manage to find a repro, I'll be glad to fix it. Can you follow-up on https://github.com/scalacenter/scalafix/issues? Thanks!