Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Running from sbt command line without full depency spec produces inconsistent results #289

Open
arobertn opened this issue Oct 7, 2022 · 2 comments

Comments

@arobertn
Copy link

arobertn commented Oct 7, 2022

I haven't had success digging into why, but if I run:

  • sbt "scalafix dependency:OrganizeImports@com.github.liancheng: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".

@arobertn
Copy link
Author

arobertn commented Oct 7, 2022

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.

@bjaglin
Copy link
Contributor

bjaglin commented Jun 3, 2023

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants