-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run RemoveUnused #1922
run RemoveUnused #1922
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
rules = [ | ||
OrganizeImports | ||
OrganizeImports, | ||
RemoveUnused | ||
] | ||
|
||
OrganizeImports { | ||
groupedImports = Explode | ||
expandRelative = true | ||
removeUnused = false | ||
removeUnused = true | ||
groups = [ | ||
"re:javax?\\." | ||
"scala." | ||
"scala.meta." | ||
"*" | ||
] | ||
} | ||
|
||
RemoveUnused { | ||
imports = false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package scalafix.test | ||
|
||
import scalafix.v1.SemanticRule | ||
import scala.meta._ | ||
|
||
import scalafix.v1._ | ||
|
||
class ExplicitSynthetic() extends SemanticRule("ExplicitSynthetic") { | ||
import scalafix.v1._ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that in Scala3, the |
||
import scala.meta._ | ||
|
||
override def fix(implicit doc: SemanticDocument): Patch = { | ||
val patches = doc.tree.collect { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// scalafix:off RemoveUnused | ||
package test | ||
|
||
import java.util.Map | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,6 @@ trait BaseCliSuite extends AnyFunSuite with DiffAssertions { | |
files: String = removeImportsPath.toString() | ||
): Unit = { | ||
test(name, SkipWindows) { | ||
val fileIsFixed = expectedExit.isOk | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused + no side effect -> line removed manually |
||
val cwd = Files.createTempDirectory("scalafix") | ||
val sourceDir = | ||
inputSourceroot.toRelative(AbsolutePath(BuildInfo.baseDirectory)).toNIO | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This false positive comes from the Scala3 run:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to either revisit #1797, revert it or stop running
RemoveUnused
on Scala 3 for projects that use scala.collection.compat.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up patching
NoAutoTupling.scala
&EscapeHatch.scala
as they didn't make a critical usage of scala.collection.compat.