Skip to content

Commit f4728ee

Browse files
committed
upgrade Scalafmt (from 1.5.1 to 3.7.4) and reformat sources
1 parent c0ec12b commit f4728ee

File tree

30 files changed

+466
-377
lines changed

30 files changed

+466
-377
lines changed

.scalafmt.conf

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
version=1.5.1
2-
align = more
3-
docstrings = JavaDoc
4-
assumeStandardLibraryStripMargin = true
1+
version = 3.7.4
2+
runner.dialect = scala3
3+
align.preset = more
4+
docstrings.style = keep
5+
rewrite.trailingCommas.style = keep
6+
align.openParenDefnSite = true
7+
newlines.avoidInResultType = true
8+
danglingParentheses.defnSite = false
9+
danglingParentheses.callSite = false
10+
newlines.source = keep
11+
newlines.implicitParamListModifierPrefer = before
512
project.git = true
613
maxColumn = 100
714
project.excludeFilters = [
@@ -12,5 +19,3 @@ project.excludeFilters = [
1219
"scalafix/output213/"
1320
"scalafix/output213-failure/"
1421
]
15-
16-

admin/scalafmt.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# set -x
44

55
HERE="`dirname $0`"
6-
VERSION="1.5.1"
6+
VERSION="3.7.4"
77
COURSIER="$HERE/.coursier"
88
SCALAFMT="$HERE/.scalafmt-$VERSION"
99

@@ -15,7 +15,7 @@ if [ ! -f $COURSIER ]; then
1515
fi
1616

1717
if [ ! -f $SCALAFMT ]; then
18-
$COURSIER bootstrap com.geirsson:scalafmt-cli_2.11:$VERSION --main org.scalafmt.cli.Cli -o $SCALAFMT
18+
$COURSIER bootstrap org.scalameta:scalafmt-cli_2.12:$VERSION --main org.scalafmt.cli.Cli -o $SCALAFMT
1919
chmod +x $SCALAFMT
2020
fi
2121

build.sbt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ lazy val root = project
1717
.in(file("."))
1818
.settings(commonSettings)
1919
.settings(
20-
name := "scala-collection-compat",
20+
name := "scala-collection-compat",
2121
publish / skip := true
2222
)
2323
.aggregate(
@@ -60,8 +60,8 @@ lazy val compat = new MultiScalaCrossProject(
6060
_.settings(ScalaModulePlugin.scalaModuleSettings)
6161
.settings(commonSettings)
6262
.settings(
63-
name := "scala-collection-compat",
64-
moduleName := "scala-collection-compat",
63+
name := "scala-collection-compat",
64+
moduleName := "scala-collection-compat",
6565
scalaModuleAutomaticModuleName := Some("scala.collection.compat"),
6666
scalacOptions ++= Seq("-feature", "-language:higherKinds", "-language:implicitConversions"),
6767
Compile / unmanagedSourceDirectories += {
@@ -87,7 +87,9 @@ lazy val compat = new MultiScalaCrossProject(
8787
import com.typesafe.tools.mima.core._
8888
import com.typesafe.tools.mima.core.ProblemFilters._
8989
Seq(
90-
exclude[ReversedMissingMethodProblem]("scala.collection.compat.PackageShared.*"), // it's package-private
90+
exclude[ReversedMissingMethodProblem](
91+
"scala.collection.compat.PackageShared.*"
92+
), // it's package-private
9193
exclude[Problem]("scala.collection.compat.*PreservingBuilder*")
9294
)
9395
}
@@ -147,8 +149,8 @@ lazy val compat = new MultiScalaCrossProject(
147149
}
148150
},
149151
versionPolicyIntention := Compatibility.None,
150-
versionCheck := {}, // I don't understand why this fails otherwise?! oh well
151-
Test / fork := false // Scala Native cannot run forked tests
152+
versionCheck := {}, // I don't understand why this fails otherwise?! oh well
153+
Test / fork := false // Scala Native cannot run forked tests
152154
).nativeEnablePlugins(ScalaNativeJUnitPlugin)
153155
)
154156

@@ -187,7 +189,7 @@ lazy val binaryCompat = project
187189
.in(file("binary-compat/test"))
188190
.settings(commonSettings)
189191
.settings(
190-
scalaVersion := scala212,
192+
scalaVersion := scala212,
191193
libraryDependencies += "com.typesafe" %% "mima-core" % "0.8.0" % Test,
192194
junit,
193195
buildInfoPackage := "build",
@@ -211,10 +213,10 @@ lazy val scalafixRules = project
211213
.settings(commonSettings)
212214
.settings(
213215
scalaModuleAutomaticModuleName := None,
214-
versionPolicyIntention := Compatibility.None,
215-
versionCheck := {}, // I don't understand why this fails otherwise?! oh well
216-
name := "scala-collection-migrations",
217-
scalaVersion := scalafixScala212,
216+
versionPolicyIntention := Compatibility.None,
217+
versionCheck := {}, // I don't understand why this fails otherwise?! oh well
218+
name := "scala-collection-migrations",
219+
scalaVersion := scalafixScala212,
218220
libraryDependencies += "ch.epfl.scala" %% "scalafix-core" % scalafixVersion
219221
)
220222

@@ -247,9 +249,9 @@ lazy val scalafixInput = project
247249
.settings(commonSettings)
248250
.settings(sharedScalafixSettings)
249251
.settings(
250-
scalaVersion := scalafixScala212,
252+
scalaVersion := scalafixScala212,
251253
publish / skip := true,
252-
headerCheck := Nil,
254+
headerCheck := Nil,
253255
addCompilerPlugin(scalafixSemanticdb),
254256
scalacOptions ++= Seq(
255257
"-Yrangepos",
@@ -265,7 +267,7 @@ val scalafixOutput = MultiScalaProject(
265267
.settings(commonSettings)
266268
.settings(
267269
publish / skip := true,
268-
headerCheck := Nil,
270+
headerCheck := Nil,
269271
)
270272
.disablePlugins(ScalafixPlugin)
271273
)
@@ -315,7 +317,7 @@ lazy val scalafixTests = project
315317
.settings(commonSettings)
316318
.settings(sharedScalafixSettings)
317319
.settings(
318-
scalaVersion := scalafixScala212,
320+
scalaVersion := scalafixScala212,
319321
publish / skip := true,
320322
libraryDependencies += "ch.epfl.scala" % "scalafix-testkit" % scalafixVersion % Test cross CrossVersion.full,
321323
scalafixTestkitOutputSourceDirectories := Seq(
@@ -325,7 +327,7 @@ lazy val scalafixTests = project
325327
output213.value
326328
),
327329
scalafixTestkitInputSourceDirectories := (scalafixInput / Compile / sourceDirectories).value,
328-
scalafixTestkitInputClasspath := (scalafixInput / Compile / fullClasspath).value,
330+
scalafixTestkitInputClasspath := (scalafixInput / Compile / fullClasspath).value,
329331
)
330332
.dependsOn(scalafixInput, scalafixRules)
331333
.enablePlugins(BuildInfoPlugin, ScalafixTestkitPlugin)

compat/src/main/scala-2.11/scala/collection/compat/package.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ package object compat extends compat.PackageShared {
2828
// the strict type of the view to be `Map` instead of `Iterable`
2929
// Instances produced by this method are used to chain `filterKeys` after `mapValues`
3030
implicit def canBuildFromIterableViewMapLike[K, V, L, W, CC[X, Y] <: Map[X, Y]]
31-
: CanBuildFrom[IterableView[(K, V), CC[K, V]], (L, W), IterableView[(L, W), CC[L, W]]] =
31+
: CanBuildFrom[IterableView[(K, V), CC[K, V]], (L, W), IterableView[(L, W), CC[L, W]]] =
3232
new CanBuildFrom[IterableView[(K, V), CC[K, V]], (L, W), IterableView[(L, W), CC[L, W]]] {
3333
// `CanBuildFrom` parameters are used as type constraints, they are not used
3434
// at run-time, hence the dummy builder implementations
@@ -37,8 +37,8 @@ package object compat extends compat.PackageShared {
3737
}
3838

3939
implicit def toTraversableLikeExtensionMethods[Repr](self: Repr)(
40-
implicit traversable: IsTraversableLike[Repr])
41-
: TraversableLikeExtensionMethods[traversable.A, Repr] =
40+
implicit
41+
traversable: IsTraversableLike[Repr]): TraversableLikeExtensionMethods[traversable.A, Repr] =
4242
new TraversableLikeExtensionMethods[traversable.A, Repr](traversable.conversion(self))
4343

4444
implicit def toSeqExtensionMethods[A](self: c.Seq[A]): SeqExtensionMethods[A] =

compat/src/main/scala-2.11/scala/util/Using.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ object Using {
236236
case _: LinkageError => 3
237237
case _: InterruptedException | _: ThreadDeath => 2
238238
case _: ControlThrowable => 0
239-
case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal
240-
case _ => -1
239+
case e if !NonFatal(e) => 1 // in case this method gets out of sync with NonFatal
240+
case _ => -1
241241
}
242242
// special-case `ControlThrowable`, which incorrectly suppresses exceptions
243243
// before 2.13

compat/src/main/scala-2.11_2.12/scala/collection/compat/CompatImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private abstract class PreservingBuilder[A, C <: TraversableOnce[A]] extends m.B
2424
val that: m.Builder[A, C]
2525
val ct: ClassTag[C]
2626

27-
//invariant: ruined => (collection == null)
27+
// invariant: ruined => (collection == null)
2828
var collection: C = null.asInstanceOf[C]
2929
var ruined = false
3030

compat/src/main/scala-2.11_2.12/scala/collection/compat/PackageShared.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ class TrulyTraversableLikeExtensionMethods[El1, Repr1](
578578
class Tuple2ZippedExtensionMethods[El1, Repr1, El2, Repr2](
579579
private val self: Tuple2Zipped[El1, Repr1, El2, Repr2]) {
580580

581-
def lazyZip[El3, Repr3, T3](t3: T3)(implicit w3: T3 => IterableLike[El3, Repr3])
582-
: Tuple3Zipped[El1, Repr1, El2, Repr2, El3, Repr3] =
581+
def lazyZip[El3, Repr3, T3](t3: T3)(implicit
582+
w3: T3 => IterableLike[El3, Repr3]): Tuple3Zipped[El1, Repr1, El2, Repr2, El3, Repr3] =
583583
new Tuple3Zipped((self.colls._1, self.colls._2, t3))
584584
}
585585

0 commit comments

Comments
 (0)