Skip to content

Commit 2695baf

Browse files
committed
Apply scalafix
1 parent 6b55cfa commit 2695baf

5 files changed

Lines changed: 45 additions & 40 deletions

File tree

http-json/src/main/scala/org/mdedetrich/pekko/http/JsonSupport.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
package org.mdedetrich.pekko.http
1919

2020
import org.apache.pekko
21+
import org.mdedetrich.pekko.json.stream.JsonStreamParser
22+
import org.typelevel.jawn.Facade
23+
2124
import pekko.http.scaladsl.model.HttpEntity
2225
import pekko.http.scaladsl.model.MediaTypes.`application/json`
2326
import pekko.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller}
2427
import pekko.http.scaladsl.util.FastFuture
25-
import org.mdedetrich.pekko.json.stream.JsonStreamParser
26-
import org.typelevel.jawn.Facade
2728

2829
trait JsonSupport {
2930

stream-json/src/main/scala/org/mdedetrich/pekko/json/stream/JsonStreamParser.scala

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,22 @@
1818
package org.mdedetrich.pekko.json.stream
1919

2020
import org.apache.pekko
21-
import pekko.NotUsed
22-
import pekko.stream.Attributes.name
23-
import pekko.stream.scaladsl.{Flow, Keep, Sink}
24-
import pekko.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
25-
import pekko.stream._
26-
import pekko.util.ByteString
2721
import org.typelevel.jawn.AsyncParser.ValueStream
2822
import org.typelevel.jawn._
2923

24+
import java.nio.ByteBuffer
25+
3026
import scala.annotation.tailrec
3127
import scala.collection.mutable.ArrayBuffer
3228
import scala.concurrent.Future
3329
import scala.util.Try
34-
import java.nio.ByteBuffer
30+
31+
import pekko.NotUsed
32+
import pekko.stream.Attributes.name
33+
import pekko.stream.scaladsl.{Flow, Keep, Sink}
34+
import pekko.stream.stage.{GraphStage, GraphStageLogic, InHandler, OutHandler}
35+
import pekko.stream._
36+
import pekko.util.ByteString
3537

3638
object JsonStreamParser {
3739

@@ -132,9 +134,9 @@ object JsonStreamParser {
132134

133135
final class JsonStreamParser[J: Facade] private (mode: AsyncParser.Mode, multiValue: Boolean)
134136
extends GraphStage[FlowShape[ByteString, J]] {
135-
private[this] val in = Inlet[ByteString]("Json.in")
136-
private[this] val out = Outlet[J]("Json.out")
137-
override val shape = FlowShape(in, out)
137+
private[this] val in = Inlet[ByteString]("Json.in")
138+
private[this] val out = Outlet[J]("Json.out")
139+
override val shape: FlowShape[ByteString, J] = FlowShape(in, out)
138140
override def createLogic(inheritedAttributes: Attributes): GraphStageLogic =
139141
new JsonStreamParser.ParserLogic[J](AsyncParser[J](mode, multiValue), shape)
140142
}

support/http-circe/src/main/scala/org/mdedetrich/pekko/http/support/CirceHttpSupport.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
package org.mdedetrich.pekko.http.support
1919

20-
import org.apache.pekko
21-
import pekko.http.scaladsl.marshalling.{Marshaller, ToEntityMarshaller}
22-
import pekko.http.scaladsl.model.MediaTypes.`application/json`
23-
import pekko.http.scaladsl.unmarshalling.FromEntityUnmarshaller
2420
import io.circe.jawn.CirceSupportParser._
2521
import io.circe.{Decoder, Encoder, Json, Printer}
26-
22+
import org.apache.pekko
2723
import org.mdedetrich.pekko.http.JsonSupport
2824
import org.mdedetrich.pekko.stream.support.CirceStreamSupport
2925

26+
import pekko.http.scaladsl.marshalling.{Marshaller, ToEntityMarshaller}
27+
import pekko.http.scaladsl.model.MediaTypes.`application/json`
28+
import pekko.http.scaladsl.unmarshalling.FromEntityUnmarshaller
29+
3030
trait CirceHttpSupport extends JsonSupport {
3131

3232
implicit def circeJsonUnmarshaller: FromEntityUnmarshaller[Json] =

support/stream-circe/src/main/scala/org/mdedetrich/pekko/stream/support/CirceStreamSupport.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
package org.mdedetrich.pekko.stream
1919
package support
2020

21-
import org.apache.pekko
22-
import pekko.NotUsed
23-
import pekko.stream.scaladsl.Flow
24-
import pekko.util.ByteString
2521
import io.circe.CursorOp.DownField
26-
import io.circe.jawn.CirceSupportParser._
2722
import io.circe._
23+
import io.circe.jawn.CirceSupportParser._
24+
import org.apache.pekko
2825
import org.mdedetrich.pekko.json.stream.JsonStreamParser
2926
import org.typelevel.jawn.AsyncParser
3027

28+
import pekko.NotUsed
29+
import pekko.stream.scaladsl.Flow
30+
import pekko.util.ByteString
31+
3132
trait CirceStreamSupport {
3233

3334
def decode[A: Decoder]: Flow[ByteString, A, NotUsed] =

tests/src/test/scala/org/mdedetrich/pekko/http/JsonSupportSpec.scala

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,9 @@
1717

1818
package org.mdedetrich.pekko.http
1919

20-
import org.apache.pekko
21-
import pekko.actor.ActorSystem
22-
import pekko.http.scaladsl.marshalling.Marshal
23-
import pekko.http.scaladsl.model.HttpCharsets.`UTF-8`
24-
import pekko.http.scaladsl.model.MediaTypes.`application/json`
25-
import pekko.http.scaladsl.model.{HttpEntity, RequestEntity, UniversalEntity}
26-
import pekko.http.scaladsl.unmarshalling.Unmarshal
27-
import pekko.stream.scaladsl.{Keep, Sink, Source}
28-
import pekko.util.ByteString
2920
import io.circe.generic.semiauto._
3021
import io.circe.{Decoder, Encoder, Printer}
22+
import org.apache.pekko
3123
import org.mdedetrich.pekko.http.support.CirceHttpSupport
3224
import org.mdedetrich.pekko.stream.support.CirceStreamSupport
3325
import org.scalatest._
@@ -38,6 +30,15 @@ import org.typelevel.jawn.{AsyncParser, ParseException}
3830
import scala.concurrent.Await
3931
import scala.concurrent.duration._
4032

33+
import pekko.actor.ActorSystem
34+
import pekko.http.scaladsl.marshalling.Marshal
35+
import pekko.http.scaladsl.model.HttpCharsets.`UTF-8`
36+
import pekko.http.scaladsl.model.MediaTypes.`application/json`
37+
import pekko.http.scaladsl.model.{HttpEntity, RequestEntity, UniversalEntity}
38+
import pekko.http.scaladsl.unmarshalling.Unmarshal
39+
import pekko.stream.scaladsl.{Keep, Sink, Source}
40+
import pekko.util.ByteString
41+
4142
case class Foo(bar: String, baz: Int, qux: List[Boolean])
4243
object Foo {
4344
implicit val decoderFoo: Decoder[Foo] = deriveDecoder
@@ -56,15 +57,15 @@ class JsonSupportSpec
5657
with Matchers
5758
with BeforeAndAfterAll {
5859

59-
val foo = Foo("bar", 42, List(true, false))
60-
val goodJson = """{"bar":"bar","baz":42,"qux":[true,false]}"""
61-
val incompleteJson = """{"bar":"bar","baz":42,"qux"""
62-
val badJson = """{"bar":"bar"}"""
63-
val badBarJson = """{"foo":{"bar":"bar"}}"""
64-
val wrongJson = """{"bar":"bar","baz":"forty two","qux":[]}"""
65-
val wrongBarJson = """{"foo":{"bar":"bar","baz":"forty two","qux":[]}}"""
66-
val invalidJson = """{"bar"="bar"}"""
67-
val prettyJson =
60+
val foo: Foo = Foo("bar", 42, List(true, false))
61+
val goodJson: String = """{"bar":"bar","baz":42,"qux":[true,false]}"""
62+
val incompleteJson: String = """{"bar":"bar","baz":42,"qux"""
63+
val badJson: String = """{"bar":"bar"}"""
64+
val badBarJson: String = """{"foo":{"bar":"bar"}}"""
65+
val wrongJson: String = """{"bar":"bar","baz":"forty two","qux":[]}"""
66+
val wrongBarJson: String = """{"foo":{"bar":"bar","baz":"forty two","qux":[]}}"""
67+
val invalidJson: String = """{"bar"="bar"}"""
68+
val prettyJson: String =
6869
"""
6970
|{
7071
| "bar" : "bar",

0 commit comments

Comments
 (0)