Skip to content

Commit

Permalink
test loading of external rule built with metaconfig hack
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Jul 15, 2022
1 parent 57042bd commit 30c8ddc
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,21 @@ class ScalafixSuite extends AnyFunSuite {
s"fetch & load instance for Scala version $scalaVersion with external dependencies"
) {
val scalafixAPI = Scalafix.fetchAndClassloadInstance(scalaVersion)
val args = scalafixAPI.newArguments
val availableRules = scalafixAPI.newArguments
.withToolClasspath(
Seq[URL]().asJava,
Seq[String]("com.nequissimus::sort-imports:0.5.2").asJava,
Seq[String](
"com.nequissimus::sort-imports:0.5.2", // scalafix 0.9.16
"com.github.xuwei-k::scalafix-rules:0.2.1" // scalafix 0.10.0
).asJava,
Seq[Repository](Repository.central()).asJava
)
assert(
args.availableRules.asScala.map(_.name).contains("RemoveUnused")
) // built-in rule
assert(
args.availableRules.asScala.map(_.name).contains("SortImports")
) // community rule
.availableRules
.asScala

assert(availableRules.map(_.name).contains("RemoveUnused"))
assert(availableRules.map(_.name).contains("SortImports"))
assert(availableRules.map(_.name).contains("KindProjector"))
}
}
val supportedScalaBinaryVersions: Set[String] = Set("2.11", "2.12", "2.13")
Expand Down

0 comments on commit 30c8ddc

Please sign in to comment.