Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core, scalafmt-dynamic to 3.8.3 #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ d338861916380701fb1a3cf557bb2b0f18792075

# Scala Steward: Reformat with scalafmt 3.8.1
d4a7535a39fe713701919d4312e10e8de78b69d9

# Scala Steward: Reformat with scalafmt 3.8.3
6d1f7bdb7321b7ef76a1e952281076c428fe0857
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.1
version = 3.8.3
maxColumn = 120

align.preset = more
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object Dependencies {
val `jwt-core` = "com.github.jwt-scala" %% "jwt-core" % JwtCoreVersion
val `scala-compact-collection` = "org.scala-lang.modules" %% "scala-collection-compat" % ScalaCompactCollectionVersion

val scalafmt = "org.scalameta" %% "scalafmt-dynamic" % "3.8.1"
val scalafmt = "org.scalameta" %% "scalafmt-dynamic" % "3.8.3"
val scalametaParsers = "org.scalameta" %% "parsers" % "4.9.9"

val netty =
Expand Down
64 changes: 32 additions & 32 deletions project/JmhBenchmarkWorkflow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ object JmhBenchmarkWorkflow {

val jmhPlugin = s"""addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "$JmhVersion")"""
val scalaSources: PathFilter = ** / "*.scala"
val files = FileTreeView.default.list(Seq(
Glob("zio-http-benchmarks/src/main/scala-2.13/**"),
Glob("zio-http-benchmarks/src/main/scala/**")),scalaSources
)
val files = FileTreeView.default.list(
Seq(Glob("zio-http-benchmarks/src/main/scala-2.13/**"), Glob("zio-http-benchmarks/src/main/scala/**")),
scalaSources,
)

/**
* Get zioHttpBenchmark file names
*/
Expand Down Expand Up @@ -42,7 +42,7 @@ object JmhBenchmarkWorkflow {
/**
* Download Artifacts and parse result
*/
def downloadArtifacts(branch: String, batchSize: Int) = groupedBenchmarks(batchSize).flatMap(l => {
def downloadArtifacts(branch: String, batchSize: Int) = groupedBenchmarks(batchSize).flatMap(l => {
Seq(
WorkflowStep.Use(
ref = UseRef.Public("actions", "download-artifact", "v3"),
Expand All @@ -51,24 +51,24 @@ object JmhBenchmarkWorkflow {
),
),
WorkflowStep.Run(
commands = List(
s"""cat ${branch}_${l.head}.txt >> ${branch}_benchmarks.txt""".stripMargin,
),
name = Some(s"Format_${branch}_${l.head}"),
commands = List(
s"""cat ${branch}_${l.head}.txt >> ${branch}_benchmarks.txt""".stripMargin,
),
name = Some(s"Format_${branch}_${l.head}"),
),
)
})

def parse_results(branch: String) = WorkflowStep.Run(
commands = List(s"""while IFS= read -r line; do
| IFS=' ' read -ra PARSED_RESULT <<< "$$line"
| echo $${PARSED_RESULT[1]} >> parsed_$branch.txt
| B_VALUE=$$(echo $${PARSED_RESULT[1]}": "$${PARSED_RESULT[4]}" ops/sec")
| echo $$B_VALUE >> $branch.txt
| done < ${branch}_benchmarks.txt""".stripMargin),
id = Some(s"${branch}_Result"),
name = Some(s"$branch Result"),
)
commands = List(s"""while IFS= read -r line; do
| IFS=' ' read -ra PARSED_RESULT <<< "$$line"
| echo $${PARSED_RESULT[1]} >> parsed_$branch.txt
| B_VALUE=$$(echo $${PARSED_RESULT[1]}": "$${PARSED_RESULT[4]}" ops/sec")
| echo $$B_VALUE >> $branch.txt
| done < ${branch}_benchmarks.txt""".stripMargin),
id = Some(s"${branch}_Result"),
name = Some(s"$branch Result"),
)

/**
* Workflow Job to cache benchmark results
Expand All @@ -81,23 +81,23 @@ object JmhBenchmarkWorkflow {
"${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}",
),
needs = dependencies(batchSize),
steps = downloadArtifacts("Main", batchSize) ++
steps = downloadArtifacts("Main", batchSize) ++
Seq(
WorkflowStep.Use(
UseRef.Public("actions", "checkout", "v2"),
Map(
"path" -> "zio-http"
)
),
WorkflowStep.Use(
UseRef.Public("actions", "checkout", "v2"),
Map(
"path" -> "zio-http",
),
),
parse_results("Main"),
WorkflowStep.Use(
UseRef.Public("actions", "cache", "v4"),
Map(
"path" -> "Main.txt",
"key" -> "jmh_benchmarks_${{ github.sha }}"
UseRef.Public("actions", "cache", "v4"),
Map(
"path" -> "Main.txt",
"key" -> "jmh_benchmarks_${{ github.sha }}",
),
),
),
),
),
)

Expand Down Expand Up @@ -147,5 +147,5 @@ object JmhBenchmarkWorkflow {
)
})

def apply(batchSize: Int): Seq[WorkflowJob] = run(batchSize) ++ cache(batchSize) // ++ jmh_compare(batchSize)
def apply(batchSize: Int): Seq[WorkflowJob] = run(batchSize) ++ cache(batchSize) // ++ jmh_compare(batchSize)
}
12 changes: 6 additions & 6 deletions zio-http-example/src/main/scala/example/WebSocketAdvanced.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ object WebSocketAdvanced extends ZIOAppDefault {
val socketApp: WebSocketApp[Any] =
Handler.webSocket { channel =>
channel.receiveAll {
case Read(WebSocketFrame.Text("end")) =>
case Read(WebSocketFrame.Text("end")) =>
channel.shutdown

// Send a "bar" if the client sends a "foo"
case Read(WebSocketFrame.Text("foo")) =>
case Read(WebSocketFrame.Text("foo")) =>
channel.send(Read(WebSocketFrame.text("bar")))

// Send a "foo" if the client sends a "bar"
case Read(WebSocketFrame.Text("bar")) =>
case Read(WebSocketFrame.Text("bar")) =>
channel.send(Read(WebSocketFrame.text("foo")))

// Echo the same message 10 times if it's not "foo" or "bar"
case Read(WebSocketFrame.Text(text)) =>
case Read(WebSocketFrame.Text(text)) =>
channel
.send(Read(WebSocketFrame.text(s"echo $text")))
.repeatN(10)
Expand All @@ -38,11 +38,11 @@ object WebSocketAdvanced extends ZIOAppDefault {
channel.send(Read(WebSocketFrame.text("Greetings!")))

// Log when the channel is getting closed
case Read(WebSocketFrame.Close(status, reason)) =>
case Read(WebSocketFrame.Close(status, reason)) =>
Console.printLine("Closing channel with status: " + status + " and reason: " + reason)

// Print the exception if it's not a normal close
case ExceptionCaught(cause) =>
case ExceptionCaught(cause) =>
Console.printLine(s"Channel error!: ${cause.getMessage}")

case _ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ object WebSocketReconnectingClient extends ZIOAppDefault {
channel.send(ChannelEvent.Read(WebSocketFrame.text("foo")))

// On receiving "foo", we'll reply with another "foo" to keep echo loop going
case Read(WebSocketFrame.Text("foo")) =>
case Read(WebSocketFrame.Text("foo")) =>
ZIO.logInfo("Received foo message.") *>
ZIO.sleep(1.second) *>
channel.send(ChannelEvent.Read(WebSocketFrame.text("foo")))

// Handle exception and convert it to failure to signal the shutdown of the socket connection via the promise
case ExceptionCaught(t) =>
case ExceptionCaught(t) =>
ZIO.fail(t)

case _ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ object WebSocketSimpleClient extends ZIOAppDefault {
channel.send(Read(WebSocketFrame.text("foo")))

// Send a "bar" if the server sends a "foo"
case Read(WebSocketFrame.Text("foo")) =>
case Read(WebSocketFrame.Text("foo")) =>
channel.send(Read(WebSocketFrame.text("bar")))

// Close the connection if the server sends a "bar"
case Read(WebSocketFrame.Text("bar")) =>
case Read(WebSocketFrame.Text("bar")) =>
ZIO.succeed(println("Goodbye!")) *> channel.send(Read(WebSocketFrame.close(1000)))

case _ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ final case class EndpointGen(config: Config) {
),
),
)
case JsonSchema.Null => throw new Exception("Null query parameters are not supported")
case JsonSchema.Null => throw new Exception("Null query parameters are not supported")
case JsonSchema.AnyJson => throw new Exception("AnyJson query parameters are not supported")
}
}
Expand Down
2 changes: 1 addition & 1 deletion zio-http-gen/src/test/resources/ComponentLion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ object Lion {

implicit val codec: Schema[Lion] = DeriveSchema.gen[Lion]

}
}
19 changes: 13 additions & 6 deletions zio-http/jvm/src/test/scala/zio/http/untitled.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ import zio.Chunk
import zio.http.Headers

new String(
Chunk(45,45,105,110,110,101,114,95,98,111,117,110,100,97,114,121,13,10,99,111,110,116,101,110,116,45,116,121,112,101,58,32,116,101,120,116,47,112,108,97,105,110,13,10,13,10,115,111,109,101,32,116,101,120,116,117,97,108,32,99,111,110,116,101,110,116,13,10,109,97,107,101,32,105,116,32,109,117,108,116,105,108,105,110,101,32,116,101,120,116,117,97,108,32,99,111,110,116,101,110,116,33,13,10,98,117,116,32,110,111,116,32,101,110,100,105,110,103,32,119,105,116,104,32,97,32,67,82,76,70,13,10)
.map(_.toByte).toArray
Chunk(45, 45, 105, 110, 110, 101, 114, 95, 98, 111, 117, 110, 100, 97, 114, 121, 13, 10, 99, 111, 110, 116, 101, 110,
116, 45, 116, 121, 112, 101, 58, 32, 116, 101, 120, 116, 47, 112, 108, 97, 105, 110, 13, 10, 13, 10, 115, 111, 109,
101, 32, 116, 101, 120, 116, 117, 97, 108, 32, 99, 111, 110, 116, 101, 110, 116, 13, 10, 109, 97, 107, 101, 32, 105,
116, 32, 109, 117, 108, 116, 105, 108, 105, 110, 101, 32, 116, 101, 120, 116, 117, 97, 108, 32, 99, 111, 110, 116,
101, 110, 116, 33, 13, 10, 98, 117, 116, 32, 110, 111, 116, 32, 101, 110, 100, 105, 110, 103, 32, 119, 105, 116,
104, 32, 97, 32, 67, 82, 76, 70, 13, 10)
.map(_.toByte)
.toArray,
)

new String(
Chunk(45,45,40,40,40,98,97,52,53,56,52,102,56,45,99,97,49,54,45,52,53,55,97,45,57,50,49,101,45,97,100,102,49,97,48,49,57,57,54,97,55,41,41,41,13,10,13,10,13,10)
.map(_.toByte).toArray
Chunk(45, 45, 40, 40, 40, 98, 97, 52, 53, 56, 52, 102, 56, 45, 99, 97, 49, 54, 45, 52, 53, 55, 97, 45, 57, 50, 49,
101, 45, 97, 100, 102, 49, 97, 48, 49, 57, 57, 54, 97, 55, 41, 41, 41, 13, 10, 13, 10, 13, 10)
.map(_.toByte)
.toArray,
)


Headers() == Headers.empty
Headers() == Headers.empty
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private[http] object UrlInterpolatorMacro {
}
}
val exampleParts = staticParts.zipAll(injectedPartExamples, "", "").flatMap { case (a, b) => List(a, b) }
val example = exampleParts.mkString
val example = exampleParts.mkString
URL.decode(example) match {
case Left(error) =>
c.abort(c.enclosingPosition, s"Invalid URL: ${error.getMessage}")
Expand Down
2 changes: 1 addition & 1 deletion zio-http/shared/src/main/scala/zio/http/MediaTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9688,7 +9688,7 @@ private[zio] trait MediaTypes {
lazy val `vnd.dolby.heaac.2`: MediaType =
new MediaType("audio", "vnd.dolby.heaac.2", compressible = false, binary = true)

lazy val `amr-wb+` : MediaType =
lazy val `amr-wb+`: MediaType =
new MediaType("audio", "amr-wb+", compressible = false, binary = true)

lazy val `dsr-es202211`: MediaType =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private[codec] object EncoderDecoder {

}
}
private val formBoundary = Boundary("----zio-http-boundary-D4792A5C-93E0-43B5-9A1F-48E38FDE5714")
private val formBoundary = Boundary("----zio-http-boundary-D4792A5C-93E0-43B5-9A1F-48E38FDE5714")
private val indexByName = flattened.content.zipWithIndex.map { case (codec, idx) =>
codec.name.getOrElse("field" + idx.toString) -> idx
}.toMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ object HttpGen {
case JsonSchema.Object(properties, _, _) =>
properties.flatMap { case (key, value) => loop(value, Some(key)) }.toSeq
case JsonSchema.Enum(values) => Seq(HttpVariable(getName(name), None, Some(s"enum: ${values.mkString(",")}")))
case JsonSchema.Null => Seq.empty
case JsonSchema.AnyJson => Seq.empty
case JsonSchema.Null => Seq.empty
case JsonSchema.AnyJson => Seq.empty
}

bodySchema0 match {
Expand Down