-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To avoid getting false positive errors (missing SemanticDB), scalafix executions with `--files` should not aggregate as they are by nature specific to a given project / Configuration. - prevent usage of scalafixAll --files - validate --files values against unmanagedSourceDirectories - allow precise completions - avoid aggregated executions: since requested files are not valid outside the project on which the task input was crafted, sbt simply ignores the run
- Loading branch information
Showing
10 changed files
with
187 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
rules = [DisableSyntax] | ||
rules = [DisableSyntax, RemoveUnused] | ||
DisableSyntax.keywords = [null] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import _root_.scalafix.sbt.{BuildInfo => Versions} | ||
|
||
val explicit = project.settings( | ||
scalaVersion := Versions.scala212 | ||
inThisBuild( | ||
List( | ||
scalaVersion := Versions.scala212, | ||
scalacOptions += "-Ywarn-unused", | ||
semanticdbEnabled := true, | ||
semanticdbVersion := scalafixSemanticdb.revision | ||
) | ||
) | ||
|
||
val ok_and_ko = project | ||
val ok_only = project |
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-scalafix/explicit-files/ok_only/src/main/scala/OK.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class OK {} |
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-scalafix/explicit-files/src/main/scala/OK.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class OK {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,38 @@ | ||
-> scalafix | ||
> ok_only / scalafix | ||
-> ok_and_ko / scalafix | ||
|
||
-> scalafix -f=explicit/src/main/scala/KO.scala | ||
-> scalafix --files=explicit/src/main/scala/KO.scala | ||
|
||
-> scalafix -f=explicit/src/main/scala/OK.scala --files=explicit/src/main/scala/KO.scala | ||
-> scalafix --files=explicit/src/main/scala/OK.scala -f=explicit/src/main/scala/KO.scala | ||
-> scalafix -f=explicit/src/main/scala/KO.scala -f=explicit/src/main/scala/OK.scala | ||
# CORRECT USAGES | ||
# -------------- | ||
|
||
> scalafix -f=explicit/src/main/scala/OK.scala | ||
> scalafix --files=explicit/src/main/scala/OK.scala | ||
# Targeting valid files within a project containing invalid files succeeds, with or without a key/value separator | ||
> ok_and_ko / scalafix -f=ok_and_ko/src/main/scala/OK.scala | ||
> ok_and_ko / scalafix --files=ok_and_ko/src/main/scala/OK.scala | ||
> ok_and_ko / scalafix -f ok_and_ko/src/main/scala/OK.scala | ||
> ok_and_ko / scalafix --files ok_and_ko/src/main/scala/OK.scala | ||
|
||
> scalafix -f explicit/src/main/scala/OK.scala | ||
> scalafix --files explicit/src/main/scala/OK.scala | ||
# Targeting invalid files fails | ||
-> ok_and_ko / scalafix -f=ok_and_ko/src/main/scala/KO.scala | ||
|
||
# Targeting valid and invalid files fails | ||
-> ok_and_ko / scalafix -f=ok_and_ko/src/main/scala/OK.scala -f=ok_and_ko/src/main/scala/KO.scala | ||
-> ok_and_ko / scalafix -f=ok_and_ko/src/main/scala/KO.scala -f=ok_and_ko/src/main/scala/OK.scala | ||
|
||
# Targeting valid files from the root project succeeds | ||
> scalafix -f=src/main/scala/OK.scala | ||
|
||
|
||
# INCORRECT USAGES | ||
# ---------------- | ||
|
||
# Targeting non-existing files fails | ||
-> ok_only / scalafix -f=ok_only/src/main/scala/NotHere.scala | ||
|
||
# Targeting with scalafixAll valid files from the correct project fails | ||
-> ok_only / scalafixAll -f=ok_only/src/main/scala/OK.scala | ||
|
||
# Targeting valid files from a different project fails | ||
-> ok_only / scalafix -f=ok_and_ko/src/main/scala/OK.scala | ||
|
||
# Targeting valid files from a different configuration fails | ||
-> ok_only / Test / scalafix -f=ok_only/src/main/scala/OK.scala |
Oops, something went wrong.