diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 70c5c1d8..aa3cd6e7 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1 +1,4 @@ af1f31128e838a3f1bc196e740c15e26de74dd7e + +# Scala Steward: Reformat with scalafmt 3.10.3 +5d73d5c3197f7a471ef0866197664dd701e53504 diff --git a/.scalafmt.conf b/.scalafmt.conf index 9569edb0..71eb5ce5 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,5 +1,5 @@ -version = 3.5.9 +version = 3.10.3 style = default diff --git a/core/src/main/scala-2.12-/jdk/CollectionConverters.scala b/core/src/main/scala-2.12-/jdk/CollectionConverters.scala index 651d8df4..e0676f17 100644 --- a/core/src/main/scala-2.12-/jdk/CollectionConverters.scala +++ b/core/src/main/scala-2.12-/jdk/CollectionConverters.scala @@ -18,4 +18,4 @@ package scala.jdk import scala.collection.convert.{DecorateAsJava, DecorateAsScala} -object CollectionConverters extends DecorateAsJava with DecorateAsScala \ No newline at end of file +object CollectionConverters extends DecorateAsJava with DecorateAsScala diff --git a/core/src/main/scala-2.12-/scala/collection/compat/view/MapViewExtensionMethods.scala b/core/src/main/scala-2.12-/scala/collection/compat/view/MapViewExtensionMethods.scala index a3afbecf..abcaa2fa 100644 --- a/core/src/main/scala-2.12-/scala/collection/compat/view/MapViewExtensionMethods.scala +++ b/core/src/main/scala-2.12-/scala/collection/compat/view/MapViewExtensionMethods.scala @@ -18,12 +18,16 @@ package scala.collection.compat.view import scala.collection.generic.CanBuildFrom -class MapViewExtensionMethods[K, V, C <: scala.collection.Map[K, V]](private val self: IterableView[(K, V), C]) extends AnyVal { - def mapValues[W, That](f: V => W)(implicit bf: CanBuildFrom[IterableView[(K, V), C], (K, W), That]): That = +class MapViewExtensionMethods[K, V, C <: scala.collection.Map[K, V]]( + private val self: IterableView[(K, V), C]) + extends AnyVal { + def mapValues[W, That](f: V => W)(implicit + bf: CanBuildFrom[IterableView[(K, V), C], (K, W), That]): That = self.map[(K, W), That] { case (k, v) => (k, f(v)) } } trait MapViewExtensions { - implicit def toMapViewExtensionMethods[K, V, C <: scala.collection.Map[K, V]](self: IterableView[(K, V), C]): MapViewExtensionMethods[K, V, C] = + implicit def toMapViewExtensionMethods[K, V, C <: scala.collection.Map[K, V]]( + self: IterableView[(K, V), C]): MapViewExtensionMethods[K, V, C] = new MapViewExtensionMethods[K, V, C](self) -} \ No newline at end of file +} diff --git a/core/src/main/scala/org/http4s/rho/bits/QueryParser.scala b/core/src/main/scala/org/http4s/rho/bits/QueryParser.scala index a9bcd562..b9357db6 100644 --- a/core/src/main/scala/org/http4s/rho/bits/QueryParser.scala +++ b/core/src/main/scala/org/http4s/rho/bits/QueryParser.scala @@ -87,7 +87,8 @@ trait QueryParsers[F[_]] extends FailureResponseOps[F] { case other => other.asInstanceOf[ResultResponse[F, B[A]]] } - } else SuccessResponse(b.result()); go() + } else SuccessResponse(b.result()); + go() } } } diff --git a/core/src/main/scala/org/http4s/rho/bits/ResultMatcher.scala b/core/src/main/scala/org/http4s/rho/bits/ResultMatcher.scala index 6c0c19d7..e72d5a85 100644 --- a/core/src/main/scala/org/http4s/rho/bits/ResultMatcher.scala +++ b/core/src/main/scala/org/http4s/rho/bits/ResultMatcher.scala @@ -186,75 +186,9 @@ trait ResultMatchers[F[_]] extends ResultMatcherMidPrioInstances[F] { /* 508 */ mLOOPDETECTED: MaybeWritable[LOOPDETECTED], /* 510 */ mNOTEXTENDED: MaybeWritable[NOTEXTENDED], /* 511 */ mNETWORKAUTHENTICATIONREQUIRED: MaybeWritable[NETWORKAUTHENTICATIONREQUIRED] - ): ResultMatcher[F, Result[ + ): ResultMatcher[ F, - // Informational - /* 100 */ CONTINUE, - /* 101 */ SWITCHINGPROTOCOLS, - /* 102 */ PROCESSING, - /* 103 */ EARLYHINTS, - // Successful - /* 200 */ OK, - /* 201 */ CREATED, - /* 202 */ ACCEPTED, - /* 203 */ NONAUTHORITATIVEINFORMATION, - /* 204 */ NOCONTENT, - /* 205 */ RESETCONTENT, - /* 206 */ PARTIALCONTENT, - /* 207 */ MULTISTATUS, - /* 208 */ ALREADYREPORTED, - /* 226 */ IMUSED, - // Redirects - /* 300 */ MULTIPLECHOICES, - /* 301 */ MOVEDPERMANENTLY, - /* 302 */ FOUND, - /* 303 */ SEEOTHER, - /* 304 */ NOTMODIFIED, - /* 307 */ TEMPORARYREDIRECT, - /* 308 */ PERMANENTREDIRECT, - // Client errors - /* 400 */ BADREQUEST, - /* 401 */ UNAUTHORIZED, - /* 402 */ PAYMENTREQUIRED, - /* 403 */ FORBIDDEN, - /* 404 */ NOTFOUND, - /* 405 */ METHODNOTALLOWED, - /* 406 */ NOTACCEPTABLE, - /* 407 */ PROXYAUTHENTICATIONREQUIRED, - /* 408 */ REQUESTTIMEOUT, - /* 409 */ CONFLICT, - /* 410 */ GONE, - /* 411 */ LENGTHREQUIRED, - /* 412 */ PRECONDITIONFAILED, - /* 413 */ PAYLOADTOOLARGE, - /* 414 */ URITOOLONG, - /* 415 */ UNSUPPORTEDMEDIATYPE, - /* 416 */ RANGENOTSATISFIABLE, - /* 417 */ EXPECTATIONFAILED, - /* 421 */ MISDIRECTEDREQUEST, - /* 422 */ UNPROCESSABLEENTITY, - /* 423 */ LOCKED, - /* 424 */ FAILEDDEPENDENCY, - /* 424 */ TOOEARLY, - /* 426 */ UPGRADEREQUIRED, - /* 428 */ PRECONDITIONREQUIRED, - /* 429 */ TOOMANYREQUESTS, - /* 431 */ REQUESTHEADERFIELDSTOOLARGE, - /* 451 */ UNAVAILABLEFORLEGALREASONS, - // Server errors - /* 500 */ INTERNALSERVERERROR, - /* 501 */ NOTIMPLEMENTED, - /* 502 */ BADGATEWAY, - /* 503 */ SERVICEUNAVAILABLE, - /* 504 */ GATEWAYTIMEOUT, - /* 505 */ HTTPVERSIONNOTSUPPORTED, - /* 506 */ VARIANTALSONEGOTIATES, - /* 507 */ INSUFFICIENTSTORAGE, - /* 508 */ LOOPDETECTED, - /* 510 */ NOTEXTENDED, - /* 511 */ NETWORKAUTHENTICATIONREQUIRED - ]] = - new ResultMatcher[F, Result[ + Result[ F, // Informational /* 100 */ CONTINUE, @@ -321,7 +255,79 @@ trait ResultMatchers[F[_]] extends ResultMatcherMidPrioInstances[F] { /* 508 */ LOOPDETECTED, /* 510 */ NOTEXTENDED, /* 511 */ NETWORKAUTHENTICATIONREQUIRED - ]] { + ] + ] = + new ResultMatcher[ + F, + Result[ + F, + // Informational + /* 100 */ CONTINUE, + /* 101 */ SWITCHINGPROTOCOLS, + /* 102 */ PROCESSING, + /* 103 */ EARLYHINTS, + // Successful + /* 200 */ OK, + /* 201 */ CREATED, + /* 202 */ ACCEPTED, + /* 203 */ NONAUTHORITATIVEINFORMATION, + /* 204 */ NOCONTENT, + /* 205 */ RESETCONTENT, + /* 206 */ PARTIALCONTENT, + /* 207 */ MULTISTATUS, + /* 208 */ ALREADYREPORTED, + /* 226 */ IMUSED, + // Redirects + /* 300 */ MULTIPLECHOICES, + /* 301 */ MOVEDPERMANENTLY, + /* 302 */ FOUND, + /* 303 */ SEEOTHER, + /* 304 */ NOTMODIFIED, + /* 307 */ TEMPORARYREDIRECT, + /* 308 */ PERMANENTREDIRECT, + // Client errors + /* 400 */ BADREQUEST, + /* 401 */ UNAUTHORIZED, + /* 402 */ PAYMENTREQUIRED, + /* 403 */ FORBIDDEN, + /* 404 */ NOTFOUND, + /* 405 */ METHODNOTALLOWED, + /* 406 */ NOTACCEPTABLE, + /* 407 */ PROXYAUTHENTICATIONREQUIRED, + /* 408 */ REQUESTTIMEOUT, + /* 409 */ CONFLICT, + /* 410 */ GONE, + /* 411 */ LENGTHREQUIRED, + /* 412 */ PRECONDITIONFAILED, + /* 413 */ PAYLOADTOOLARGE, + /* 414 */ URITOOLONG, + /* 415 */ UNSUPPORTEDMEDIATYPE, + /* 416 */ RANGENOTSATISFIABLE, + /* 417 */ EXPECTATIONFAILED, + /* 421 */ MISDIRECTEDREQUEST, + /* 422 */ UNPROCESSABLEENTITY, + /* 423 */ LOCKED, + /* 424 */ FAILEDDEPENDENCY, + /* 424 */ TOOEARLY, + /* 426 */ UPGRADEREQUIRED, + /* 428 */ PRECONDITIONREQUIRED, + /* 429 */ TOOMANYREQUESTS, + /* 431 */ REQUESTHEADERFIELDSTOOLARGE, + /* 451 */ UNAVAILABLEFORLEGALREASONS, + // Server errors + /* 500 */ INTERNALSERVERERROR, + /* 501 */ NOTIMPLEMENTED, + /* 502 */ BADGATEWAY, + /* 503 */ SERVICEUNAVAILABLE, + /* 504 */ GATEWAYTIMEOUT, + /* 505 */ HTTPVERSIONNOTSUPPORTED, + /* 506 */ VARIANTALSONEGOTIATES, + /* 507 */ INSUFFICIENTSTORAGE, + /* 508 */ LOOPDETECTED, + /* 510 */ NOTEXTENDED, + /* 511 */ NETWORKAUTHENTICATIONREQUIRED + ] + ] { override lazy val encodings: Set[MediaType] = allTpes.flatMap { case (_, m) => m.encodings }.toSet diff --git a/examples/src/main/scala/com/http4s/rho/swagger/demo/MyRoutes.scala b/examples/src/main/scala/com/http4s/rho/swagger/demo/MyRoutes.scala index d4b0baf5..7dc6323c 100644 --- a/examples/src/main/scala/com/http4s/rho/swagger/demo/MyRoutes.scala +++ b/examples/src/main/scala/com/http4s/rho/swagger/demo/MyRoutes.scala @@ -87,15 +87,13 @@ class MyRoutes[F[+_]: Async](swaggerSyntax: SwaggerSyntax[F]) "Adds the cookie Foo=bar to the client" ** "cookies" @@ - GET / "addcookie" |>> { - Ok("You now have a good cookie!").map(_.addCookie("Foo", "bar")) - } + GET / "addcookie" |>> + Ok("You now have a good cookie!").map(_.addCookie("Foo", "bar")) "Sets the cookie Foo=barr to the client" ** "cookies" @@ - GET / "addbadcookie" |>> { - Ok("You now have an evil cookie!").map(_.addCookie("Foo", "barr")) - } + GET / "addbadcookie" |>> + Ok("You now have an evil cookie!").map(_.addCookie("Foo", "barr")) "Checks the Foo cookie to make sure its 'bar'" ** "cookies" @@