Skip to content

Commit

Permalink
Upgrade Scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Olafur Pall Geirsson committed Apr 18, 2020
1 parent 2ea4b1c commit 4711f71
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "2.0.0"
version = "2.4.2"
assumeStandardLibraryStripMargin = true
align = none
project.git = true
Binary file modified bin/scalafmt
Binary file not shown.
4 changes: 1 addition & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ inThisBuild(
scalaVersion := scala212,
scalacOptions += "-Yrangepos",
organization := "com.geirsson",
version ~= { old =>
old.replace('+', '-')
},
version ~= { old => old.replace('+', '-') },
licenses := Seq(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
Expand Down
4 changes: 1 addition & 3 deletions metaconfig-core/shared/src/main/scala/metaconfig/Conf.scala
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ object Conf {
): Configured[Option[T]] =
ConfGet
.getKey(this, path +: extraNames)
.map(
value => ev.read(value).map(Some(_))
)
.map(value => ev.read(value).map(Some(_)))
.getOrElse(Configured.Ok(None))
}
object Obj {
Expand Down
3 changes: 2 additions & 1 deletion metaconfig-core/shared/src/main/scala/metaconfig/Input.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ sealed abstract class Input(val path: String, val text: String)
buf += (i + 1)
i += 1
}
if (buf.last != chars.length) buf += chars.length // sentinel value used for binary search
if (buf.last != chars.length)
buf += chars.length // sentinel value used for binary search
buf.toArray
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ case class CliApp(
case Ok(value) =>
command.run(value, app)
case NotOk(error) =>
error.all.foreach { message =>
app.error(message)
}
error.all.foreach { message => app.error(message) }
1
}
case None =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ object TabCompleteCommand extends Command[TabCompleteOptions]("tab-complete") {
case flag :: last :: Nil => Some(flag)
case _ => None
}
val setting = secondLast.flatMap(
flag => inlined.get(Case.kebabToCamel(flag.stripPrefix("--")))
val setting = secondLast.flatMap(flag =>
inlined.get(Case.kebabToCamel(flag.stripPrefix("--")))
)
val context = TabCompletionContext(
options.format,
Expand All @@ -63,9 +63,7 @@ object TabCompleteCommand extends Command[TabCompleteOptions]("tab-complete") {
}
}
private def renderCompletions(items: List[String], app: CliApp): Unit = {
items.foreach { item =>
renderCompletion(TabCompletionItem(item), app)
}
items.foreach { item => renderCompletion(TabCompletionItem(item), app) }
}

private def renderCompletion(item: TabCompletionItem, app: CliApp): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ object ConfGet {
if (chars(i) == '\n') buf += (i + 1)
i += 1
}
if (buf.last != chars.length) buf += chars.length // sentinel value used for binary search
if (buf.last != chars.length)
buf += chars.length // sentinel value used for binary search
buf.toArray
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ class Macros(val c: blackbox.Context) {
Nil
}

val finalAnnots = repeated ::: dynamic ::: flag ::: tabCompletePath ::: baseAnnots
val finalAnnots =
repeated ::: dynamic ::: flag ::: tabCompletePath ::: baseAnnots
val fieldsParamTpe = c.internal.typeRef(
NoPrefix,
weakTypeOf[Surface[_]].typeSymbol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ class CodecRoundtripSuite extends munit.ScalaCheckSuite {
}

property("roundtrip AllTheAnnotations") {
forAll { a: AllTheAnnotations =>
checkRoundtrip(a)
}
forAll { a: AllTheAnnotations => checkRoundtrip(a) }
}

property("roundtrip Outer") {
forAll { a: Outer =>
checkRoundtrip(a)
}
forAll { a: Outer => checkRoundtrip(a) }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ class HoconPrinterRoundtripSuite extends munit.ScalaCheckSuite {
)

property("roundtrip") {
forAll { conf: ConfShow =>
assertRoundtrip(conf.str)
}
forAll { conf: ConfShow => assertRoundtrip(conf.str) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class SconfigPropertySuite extends munit.ScalaCheckSuite {
)

property("roundtrip") {
forAll { (a: ConfShow, b: ConfShow) =>
assertRoundtrip(a.str, b.str)
}
forAll { (a: ConfShow, b: ConfShow) => assertRoundtrip(a.str, b.str) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class HoconPrinterRoundtripSuite extends munit.ScalaCheckSuite {
}

property("roundtrip") {
forAll { conf: ConfShow =>
assertRoundtrip(conf.str)
}
forAll { conf: ConfShow => assertRoundtrip(conf.str) }
}
ignore(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ class TypesafeConfigPropertySuite extends munit.ScalaCheckSuite {
}

property("roundtrip") {
forAll { (a: ConfShow, b: ConfShow) =>
assertRoundtrip(a.str, b.str)
}
forAll { (a: ConfShow, b: ConfShow) => assertRoundtrip(a.str, b.str) }
}

check(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,19 @@ class DeriveSurfaceSuite extends munit.FunSuite {
assert(settings.settings.length == 4)
val notIterable :: tail = settings.settings
assert(!notIterable.isRepeated)
tail.foreach { setting =>
assert(setting.isRepeated, setting.name)
}
tail.foreach { setting => assert(setting.isRepeated, setting.name) }
}

case class CustomTypePrinting(a: Int, b: Option[Int], c: List[String])
test("tprint") {
import pprint.TPrint
implicit val intPrint = TPrint.literal[Int]("number")
implicit def optionPrint[T](implicit ev: TPrint[T]): TPrint[Option[T]] =
TPrint.make { implicit colors =>
"(" + ev.render + ")"
}
TPrint.make { implicit colors => "(" + ev.render + ")" }
implicit def iterablePrint[C[x] <: Iterable[x], T](
implicit ev: TPrint[T]
): TPrint[C[T]] =
TPrint.make { implicit colors =>
"[" + ev.render + " ...]"
}
TPrint.make { implicit colors => "[" + ev.render + " ...]" }
implicit val surface = generic.deriveSurface[CustomTypePrinting]
val a :: b :: c :: Nil = Settings[CustomTypePrinting].settings
assert(a.tpe == "number")
Expand Down

0 comments on commit 4711f71

Please sign in to comment.