-
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.
support running scalafix on projects with sources at the root
When defining local rules using the Scalafix configuration, libraryDependencies must be defined, as documented in: https://scalacenter.github.io/scalafix/docs/developers/local-rules.html. We could add it by default, but it would unnecessarily clutter the update task in 99.9% of the plugin use cases. When projects have a custom directory layout (via scalaSource), users could not know that Scalafix settings would need to be updated to exclude sources potentially at the root (sourcesInBase), in order to prevent compilation errors as Scalafix does not have the Scala libs, causing: > scala.reflect.internal.MissingRequirementError: object scala in > compiler mirror not found. This commit disables sourcesInBase by default to prevent this, as the local rules have no reason to share code with other default configurations anyway.
- Loading branch information
1 parent
9b6b3b9
commit 1c9268b
Showing
5 changed files
with
14 additions
and
1 deletion.
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
3 changes: 3 additions & 0 deletions
3
src/sbt-test/sbt-scalafix/custom-src-directory/app/ProcedureSyntax.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,3 @@ | ||
object ProcedureSyntax { | ||
def unit {} | ||
} |
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,3 @@ | ||
val app = project.settings( | ||
scalaSource.in(Compile) := baseDirectory.value | ||
) |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-scalafix/custom-src-directory/project/plugins.sbt
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,2 @@ | ||
resolvers += Resolver.sonatypeRepo("public") | ||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % sys.props("plugin.version")) |
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,3 @@ | ||
-> app/scalafix --test ProcedureSyntax | ||
> app/scalafix ProcedureSyntax | ||
> app/scalafix --test ProcedureSyntax |