Skip to content

Commit

Permalink
cross-build to 2.11, 2.12 & 2.13 (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin authored Jun 2, 2020
1 parent 955aa95 commit 75d5035
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ inThisBuild(
)
),
scalaVersion := V.scala212,
crossScalaVersions := List(V.scala211, V.scala212, V.scala213),
addCompilerPlugin(scalafixSemanticdb),
scalacOptions ++= List(
"-Yrangepos",
"-P:semanticdb:synthetics:on"
"-P:semanticdb:synthetics:on",
"-deprecation"
)
)
)
Expand Down
8 changes: 5 additions & 3 deletions rules/src/main/scala/fix/ImportGroup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private class ImportGroupTraverser(listBuffer: ListBuffer[ListBuffer[Import]]) e
}
}

case class ImportGroup(value: List[Import]) extends Traversable[Import] {
case class ImportGroup(value: List[Import]) extends Iterable[Import] {

def sortWith(ordering: Ordering[Import]): ImportGroup = ImportGroup(value.sortWith(ordering.lt))

Expand All @@ -34,7 +34,7 @@ case class ImportGroup(value: List[Import]) extends Traversable[Import] {
blocks
.find(_.matches(imp.children.head.syntax))
.getOrElse(Block.Default)
}.mapValues(ImportGroup(_))
}.mapValues(ImportGroup(_)).toMap

def containPosition(pos: Position): Boolean =
pos.start > value.head.pos.start && pos.end < value.last.pos.end
Expand All @@ -47,7 +47,9 @@ case class ImportGroup(value: List[Import]) extends Traversable[Import] {
}
.toMap

override def nonEmpty: Boolean = value.nonEmpty
override def isEmpty: Boolean = value.isEmpty

override def foreach[U](f: Import => U): Unit = value.foreach(f)

override def iterator: Iterator[scala.meta.Import] = value.iterator
}
2 changes: 1 addition & 1 deletion rules/src/main/scala/fix/ImportOrdering.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class WildcardAndGroupFirstSort extends ImportOrdering {

private def transformForSorting(imp: Import): (String, String) = {
val strImp = strFirstImport(imp)
(strImp, groupRegex.replaceAllIn(wildcardRegex.replaceAllIn(strImp, ".\0"), ".\1"))
(strImp, groupRegex.replaceAllIn(wildcardRegex.replaceAllIn(strImp, ".\u0000"), ".\u0001"))
}

override def compare(x: Import, y: Import): Int =
Expand Down

0 comments on commit 75d5035

Please sign in to comment.