Skip to content

Commit e5ee373

Browse files
Migrating to scalafix 0.6.X
1 parent dfdc979 commit e5ee373

25 files changed

+395
-406
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ matrix:
7676
# | oraclejdk8 | 2.13.0-M5 | js | 0.6.23 | |
7777
# | oraclejdk8 | 2.12.6 | jvm | | true |
7878

79-
before_script: ./checkCLA.sh
79+
before_script:
80+
- admin/checkCLA.sh
81+
8082
script:
8183
- java -version
8284
- sbt ci
File renamed without changes.

build.sbt

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import ScalaModulePlugin._
22
import sbtcrossproject.{crossProject, CrossType}
3-
import _root_.scalafix.Versions.{version => scalafixVersion, scala212 => scalafixScala212}
3+
import _root_.scalafix.internal.sbtscalafix.BuildInfo.{
4+
scalafixVersion,
5+
scala212 => scalafixScala212
6+
}
47

58
lazy val root = project
69
.in(file("."))
@@ -173,7 +176,11 @@ lazy val `scalafix-input` = project
173176
.settings(dontPublish)
174177
.settings(
175178
scalaVersion := scalafixScala212,
176-
scalafixSourceroot := sourceDirectory.in(Compile).value
179+
addCompilerPlugin(scalafixSemanticdb),
180+
scalacOptions ++= Seq(
181+
"-Yrangepos",
182+
"-P:semanticdb:synthetics:on"
183+
)
177184
)
178185
.dependsOn(`scalafix-data212`)
179186

@@ -183,15 +190,20 @@ val `scalafix-output` = MultiScalaProject("scalafix-output",
183190
.settings(dontPublish)
184191
.disablePlugins(ScalafixPlugin))
185192

186-
lazy val output212 = Def.setting((baseDirectory in ThisBuild).value / "scalafix/output212/src/main")
187-
lazy val addOutput212 = unmanagedSourceDirectories in Compile += output212.value / "scala"
193+
lazy val outputCross =
194+
Def.setting((baseDirectory in ThisBuild).value / "scalafix/output/src/main/scala")
195+
196+
lazy val output212 =
197+
Def.setting((baseDirectory in ThisBuild).value / "scalafix/output212/src/main/scala")
198+
lazy val addOutput212 = unmanagedSourceDirectories in Compile += output212.value
188199

189200
lazy val output212Plus =
190-
Def.setting((baseDirectory in ThisBuild).value / "scalafix/output212+/src/main")
191-
lazy val addOutput212Plus = unmanagedSourceDirectories in Compile += output212Plus.value / "scala"
201+
Def.setting((baseDirectory in ThisBuild).value / "scalafix/output212+/src/main/scala")
202+
lazy val addOutput212Plus = unmanagedSourceDirectories in Compile += output212Plus.value
192203

193-
lazy val output213 = Def.setting((baseDirectory in ThisBuild).value / "scalafix/output213/src/main")
194-
lazy val addOutput213 = unmanagedSourceDirectories in Compile += output213.value / "scala"
204+
lazy val output213 =
205+
Def.setting((baseDirectory in ThisBuild).value / "scalafix/output213/src/main/scala")
206+
lazy val addOutput213 = unmanagedSourceDirectories in Compile += output213.value
195207

196208
lazy val `scalafix-output211` = `scalafix-output`(
197209
scala211,
@@ -226,28 +238,15 @@ lazy val `scalafix-tests` = project
226238
.settings(
227239
scalaVersion := scalafixScala212,
228240
libraryDependencies += "ch.epfl.scala" % "scalafix-testkit" % scalafixVersion % Test cross CrossVersion.full,
229-
buildInfoPackage := "build",
230-
buildInfoKeys := Seq[BuildInfoKey](
231-
"inputSourceroot" -> sourceDirectory.in(`scalafix-input`, Compile).value,
232-
"outputSourceroot" -> (baseDirectory in ThisBuild).value / "scalafix/output/src/main",
233-
"output212Sourceroot" -> output212.value,
234-
"output212PlusSourceroot" -> output212Plus.value,
235-
"output213Sourceroot" -> output213.value,
236-
"output213FailureSourceroot" -> sourceDirectory
237-
.in(`scalafix-output213-failure`, Compile)
238-
.value,
239-
"inputClassdirectory" -> classDirectory.in(`scalafix-input`, Compile).value
240-
),
241-
test in Test := (test in Test)
242-
.dependsOn(
243-
compile in (`scalafix-output211`, Compile),
244-
compile in (`scalafix-output212`, Compile),
245-
compile in (`scalafix-output213`, Compile)
246-
)
247-
.value
241+
scalafixTestkitOutputSourceDirectories := Seq(outputCross.value,
242+
output212.value,
243+
output212Plus.value,
244+
output213.value),
245+
scalafixTestkitInputSourceDirectories := sourceDirectories.in(`scalafix-input`, Compile).value,
246+
scalafixTestkitInputClasspath := fullClasspath.in(`scalafix-input`, Compile).value
248247
)
249248
.dependsOn(`scalafix-input`, `scalafix-rules`)
250-
.enablePlugins(BuildInfoPlugin)
249+
.enablePlugins(BuildInfoPlugin, ScalafixTestkitPlugin)
251250

252251
lazy val dontPublish = Seq(
253252
publishArtifact := false,

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ val scalaJSVersion = Option(System.getenv("SCALAJS_VERSION")).filter(_.nonEmpty)
1010
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
1111
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.5.0")
1212
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")
13-
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.10")
13+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.6.0-M15")
1414
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
1515
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
1616

scalafix/input/src/main/scala/fix/BreakoutSrc.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,5 @@ class BreakoutSrc(ts: Traversable[Int], vec: Vector[Int], list: List[Int], seq:
103103
List(1 -> "1").map(x => x)(breakOut): immutable.IntMap[String]
104104
List(1L -> "1").map(x => x)(breakOut): immutable.LongMap[String]
105105
List(1L -> "1").map(x => x)(breakOut): mutable.LongMap[String]
106+
List(1).map(x => x)(breakOut): collection.BitSet
106107
}

scalafix/input/src/main/scala/fix/CompanionSrc.scala

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,40 @@ rule = "scala:fix.CrossCompat"
33
*/
44
package fix
55

6-
import scala.collection.immutable
7-
import scala.collection.mutable
6+
import scala.{collection => c}
7+
import scala.collection.{immutable => i, mutable => m}
88

99
object CompanionSrc {
1010

11-
(null: collection.IndexedSeq[Int]).companion
12-
(null: collection.Iterable[Int]).companion
13-
(null: collection.Seq[Int]).companion
14-
(null: collection.Traversable[Int]).companion
11+
(null: c.IndexedSeq[Int]).companion
12+
(null: c.Iterable[Int]).companion
13+
(null: c.Seq[Int]).companion
14+
(null: c.Traversable[Int]).companion
1515

16-
(null: immutable.HashSet[Int]).companion
17-
(null: immutable.IndexedSeq[Int]).companion
18-
(null: immutable.Iterable[Int]).companion
19-
(null: immutable.LinearSeq[Int]).companion
20-
(null: immutable.List[Int]).companion
21-
(null: immutable.ListSet[Int]).companion
22-
(null: immutable.Queue[Int]).companion
23-
(null: immutable.Seq[Int]).companion
24-
(null: immutable.Set[Int]).companion
25-
(null: immutable.Stream[Int]).companion
26-
(null: immutable.Traversable[Int]).companion
27-
(null: immutable.Vector[Int]).companion
16+
(null: i.HashSet[Int]).companion
17+
(null: i.IndexedSeq[Int]).companion
18+
(null: i.Iterable[Int]).companion
19+
(null: i.LinearSeq[Int]).companion
20+
(null: i.List[Int]).companion
21+
(null: i.ListSet[Int]).companion
22+
(null: i.Queue[Int]).companion
23+
(null: i.Seq[Int]).companion
24+
(null: i.Set[Int]).companion
25+
(null: i.Stream[Int]).companion
26+
(null: i.Traversable[Int]).companion
27+
(null: i.Vector[Int]).companion
2828

29-
(null: mutable.ArrayBuffer[Int]).companion
30-
(null: mutable.ArraySeq[Int]).companion
31-
(null: mutable.ArrayStack[Int]).companion
32-
(null: mutable.Buffer[Int]).companion
33-
(null: mutable.HashSet[Int]).companion
34-
(null: mutable.IndexedSeq[Int]).companion
35-
(null: mutable.Iterable[Int]).companion
36-
(null: mutable.LinearSeq[Int]).companion
37-
(null: mutable.LinkedHashSet[Int]).companion
38-
(null: mutable.Queue[Int]).companion
39-
(null: mutable.Seq[Int]).companion
40-
(null: mutable.Set[Int]).companion
41-
(null: mutable.Traversable[Int]).companion
29+
(null: m.ArrayBuffer[Int]).companion
30+
(null: m.ArraySeq[Int]).companion
31+
(null: m.ArrayStack[Int]).companion
32+
(null: m.Buffer[Int]).companion
33+
(null: m.HashSet[Int]).companion
34+
(null: m.IndexedSeq[Int]).companion
35+
(null: m.Iterable[Int]).companion
36+
(null: m.LinearSeq[Int]).companion
37+
(null: m.LinkedHashSet[Int]).companion
38+
(null: m.Queue[Int]).companion
39+
(null: m.Seq[Int]).companion
40+
(null: m.Set[Int]).companion
41+
(null: m.Traversable[Int]).companion
4242
}

scalafix/input/src/main/scala/fix/SetMapSrc.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ rule = "scala:fix.CrossCompat"
44
package fix
55

66
class SetMapSrc(set: Set[Int], map: Map[Int, Int]) {
7+
set + 1
78
set + (2, 3)
89
map + (2 -> 3, 3 -> 4)
910
(set + (2, 3)).toString

scalafix/input/src/main/scala/fix/TraversableSrc.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ trait TraversableSrc {
1111
val cto: collection.TraversableOnce[Int]
1212

1313
val t: Traversable[Int]
14+
t.toIterator
1415
val ct: collection.Traversable[Int]
1516
val it: immutable.Traversable[Int]
1617
val mt: mutable.Traversable[Int]

scalafix/output/src/main/scala/fix/BreakoutSrc.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package fix
66
import scala.collection.{immutable, mutable}
77
import scala.concurrent.Future
88
import scala.concurrent.ExecutionContext.Implicits.global
9+
import scala.Iterable
910
import scala.collection.compat._
1011

1112
class BreakoutSrc(ts: Iterable[Int], vec: Vector[Int], list: List[Int], seq: Seq[Int]) {
@@ -103,4 +104,5 @@ class BreakoutSrc(ts: Iterable[Int], vec: Vector[Int], list: List[Int], seq: Seq
103104
scala.collection.immutable.IntMap.from(List(1 -> "1").iterator.map(x => x)): immutable.IntMap[String]
104105
scala.collection.immutable.LongMap.from(List(1L -> "1").iterator.map(x => x)): immutable.LongMap[String]
105106
scala.collection.mutable.LongMap.from(List(1L -> "1").iterator.map(x => x)): mutable.LongMap[String]
107+
scala.collection.BitSet.from(List(1).iterator.map(x => x)): collection.BitSet
106108
}

scalafix/output/src/main/scala/fix/CompanionSrc.scala

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,43 @@
33

44
package fix
55

6-
import scala.collection.immutable
7-
import scala.collection.mutable
6+
import scala.{collection => c}
7+
import scala.collection.{immutable => i, mutable => m}
8+
import scala.collection
9+
import scala.collection.{ immutable, mutable }
810
import scala.collection.compat._
911

1012
object CompanionSrc {
1113

12-
(null: collection.IndexedSeq[Int]).iterableFactory
13-
(null: collection.Iterable[Int]).iterableFactory
14-
(null: collection.Seq[Int]).iterableFactory
14+
(null: c.IndexedSeq[Int]).iterableFactory
15+
(null: c.Iterable[Int]).iterableFactory
16+
(null: c.Seq[Int]).iterableFactory
1517
(null: collection.Iterable[Int]).iterableFactory
1618

17-
(null: immutable.HashSet[Int]).iterableFactory
18-
(null: immutable.IndexedSeq[Int]).iterableFactory
19-
(null: immutable.Iterable[Int]).iterableFactory
20-
(null: immutable.LinearSeq[Int]).iterableFactory
21-
(null: immutable.List[Int]).iterableFactory
22-
(null: immutable.ListSet[Int]).iterableFactory
23-
(null: immutable.Queue[Int]).iterableFactory
24-
(null: immutable.Seq[Int]).iterableFactory
25-
(null: immutable.Set[Int]).iterableFactory
26-
(null: immutable.Stream[Int]).iterableFactory
19+
(null: i.HashSet[Int]).iterableFactory
20+
(null: i.IndexedSeq[Int]).iterableFactory
21+
(null: i.Iterable[Int]).iterableFactory
22+
(null: i.LinearSeq[Int]).iterableFactory
23+
(null: i.List[Int]).iterableFactory
24+
(null: i.ListSet[Int]).iterableFactory
25+
(null: i.Queue[Int]).iterableFactory
26+
(null: i.Seq[Int]).iterableFactory
27+
(null: i.Set[Int]).iterableFactory
28+
(null: i.Stream[Int]).iterableFactory
2729
(null: immutable.Iterable[Int]).iterableFactory
28-
(null: immutable.Vector[Int]).iterableFactory
29-
30-
(null: mutable.ArrayBuffer[Int]).iterableFactory
31-
(null: mutable.ArraySeq[Int]).iterableFactory
32-
(null: mutable.ArrayStack[Int]).iterableFactory
33-
(null: mutable.Buffer[Int]).iterableFactory
34-
(null: mutable.HashSet[Int]).iterableFactory
35-
(null: mutable.IndexedSeq[Int]).iterableFactory
36-
(null: mutable.Iterable[Int]).iterableFactory
37-
(null: mutable.LinearSeq[Int]).iterableFactory
38-
(null: mutable.LinkedHashSet[Int]).iterableFactory
39-
(null: mutable.Queue[Int]).iterableFactory
40-
(null: mutable.Seq[Int]).iterableFactory
41-
(null: mutable.Set[Int]).iterableFactory
30+
(null: i.Vector[Int]).iterableFactory
31+
32+
(null: m.ArrayBuffer[Int]).iterableFactory
33+
(null: m.ArraySeq[Int]).iterableFactory
34+
(null: m.ArrayStack[Int]).iterableFactory
35+
(null: m.Buffer[Int]).iterableFactory
36+
(null: m.HashSet[Int]).iterableFactory
37+
(null: m.IndexedSeq[Int]).iterableFactory
38+
(null: m.Iterable[Int]).iterableFactory
39+
(null: m.LinearSeq[Int]).iterableFactory
40+
(null: m.LinkedHashSet[Int]).iterableFactory
41+
(null: m.Queue[Int]).iterableFactory
42+
(null: m.Seq[Int]).iterableFactory
43+
(null: m.Set[Int]).iterableFactory
4244
(null: mutable.Iterable[Int]).iterableFactory
4345
}

0 commit comments

Comments
 (0)