Skip to content

Commit 7a1a6a6

Browse files
committed
chore: Upgrade to scala 3.6.3
1 parent 95035b6 commit 7a1a6a6

File tree

8 files changed

+31
-23
lines changed

8 files changed

+31
-23
lines changed

build.sbt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ ThisBuild / tlCiDependencyGraphJob := true
3030
ThisBuild / autoAPIMappings := true
3131

3232
lazy val sharedSettings = Seq(
33-
scalaVersion := "3.5.2",
33+
scalaVersion := versions.scala,
34+
scalacOptions ++= Seq(
35+
"-source:3.5"
36+
),
3437
libraryDependencies ++= Seq(
3538
"org.scalameta" %% "munit" % versions.munit.core % Test
3639
),

modules/core/src/main/scala/pillars/Metrics.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ object Metrics:
4343
"http.response.status" -> {
4444
case Right(r) =>
4545
r.code match
46-
case c if c.isInformational => "1xx"
47-
case c if c.isSuccess => "2xx"
48-
case c if c.isRedirect => "3xx"
49-
case c if c.isClientError => "4xx"
50-
case c if c.isServerError => "5xx"
51-
case _ => ""
52-
case Left(_) => "5xx"
46+
case c if c.isInformational => "1xx".some
47+
case c if c.isSuccess => "2xx".some
48+
case c if c.isRedirect => "3xx".some
49+
case c if c.isClientError => "4xx".some
50+
case c if c.isServerError => "5xx".some
51+
case _ => None
52+
case Left(_) => "5xx".some
5353
},
5454
"http.response.status_code" -> {
55-
case Right(r) => r.code.toString
56-
case Left(_) => "500"
55+
case Right(r) => r.code.toString.some
56+
case Left(_) => "500".some
5757
},
5858
"error.type" -> {
59-
case Left(ex: PillarsError) => ex.code
60-
case Left(ex) => ex.getClass.getName
61-
case _ => ""
59+
case Left(ex: PillarsError) => ex.code.some
60+
case Left(ex) => ex.getClass.getName.some
61+
case _ => None
6262
}
6363
)
6464
)
@@ -248,7 +248,7 @@ object Metrics:
248248
private def asOpenTelemetryAttributes(res: Either[Throwable, ServerResponse[?]], phase: Option[String]) =
249249
val attributes = labels.forResponse
250250
.foldLeft(List.empty[Attribute[String]]): (b, label) =>
251-
b :+ Attribute(AttributeKey.string(label._1), label._2(res))
251+
b :+ Attribute(AttributeKey.string(label._1), label._2(res).getOrElse(""))
252252
phase match
253253
case Some(value) => attributes :+ Attribute(AttributeKey.string(labels.forResponsePhase.name), value)
254254
case None => attributes

modules/core/src/main/scala/pillars/graph.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ object graph:
4242
Left(GraphError.MissingDependency(missing))
4343
else
4444
loop(items, List.empty, Set.empty, Set.empty)
45+
end extension
4546

4647
enum GraphError(val number: ErrorNumber) extends PillarsError:
4748
override def code: Code = Code("GRAPH")

modules/core/src/main/scala/pillars/probes.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import pillars.probes.endpoints.*
2323
import pillars.probes.views.CheckStatus
2424
import pillars.probes.views.HealthStatus
2525
import scala.concurrent.duration.*
26-
import sttp.model.*
2726
import sttp.tapir.Schema
2827
import sttp.tapir.given
2928
import sttp.tapir.json.circe.jsonBody
@@ -155,13 +154,16 @@ object probes:
155154

156155
object endpoints:
157156
private val prefix = baseEndpoint.in("probes")
158-
def liveness = prefix.get.in("healthz").description("Liveness probe").out(stringBody)
159-
def readiness =
157+
def liveness =
158+
prefix.get.in("healthz").description("Liveness probe").out(stringBody)
159+
160+
def readiness =
160161
prefix.get
161162
.in("health")
162163
.description("Readiness probe")
163164
.out(jsonBody[HealthStatus])
164-
def all = List(liveness, readiness)
165+
166+
def all = List(liveness, readiness)
165167
end endpoints
166168
object views:
167169
final case class HealthStatus(status: Status, checks: List[CheckStatus]) derives Codec.AsObject, Schema

modules/flags/src/main/scala/pillars/flags/package.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ import sttp.tapir.codec.iron.*
1515
import sttp.tapir.codec.iron.given
1616

1717
package object flags:
18-
given Encoder[Status] = Encoder.encodeString.contramap:
18+
given Encoder[Status] = Encoder.encodeString.contramap {
1919
case Status.Enabled => "enabled"
2020
case Status.Disabled => "disabled"
21+
}
2122

22-
given Decoder[Status] = Decoder.decodeString.emap:
23+
given Decoder[Status] = Decoder.decodeString.emap {
2324
case "enabled" => Right(Status.Enabled)
2425
case "disabled" => Right(Status.Disabled)
2526
case other => Left(s"Invalid status $other")
27+
}
2628

2729
given Schema[Status] = Schema.derived
2830

modules/redis-rediculous/src/main/scala/pillars/redis_rediculous/redis.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final case class Redis[F[_]: MonadCancelThrow](config: RedisConfig, connection:
4141
val probe = new Probe[F]:
4242
override def component: Component = Component(Component.Name("redis"), Component.Type.Datastore)
4343
override def check: F[Boolean] = connection.use { client =>
44-
RedisCommands.ping[io.chrisdavenport.rediculous.Redis[F, *]].run(client) map {
44+
RedisCommands.ping[io.chrisdavenport.rediculous.Redis[F, *]].run(client).map {
4545
case Ok | Pong => true
4646
case _ => false
4747
}

project/Dependencies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sbt.*
22

33
object versions {
4-
val scala = "3.5.2"
4+
val scala = "3.6.3"
55
// Dependencies
66
val cats = "2.13.0"
77
val catsEffect = "3.5.7"

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.5")
1+
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.7")
22
// Build
33
addSbtPlugin("com.timushev.sbt" % "sbt-rewarn" % "0.1.3")
44
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.3.1")

0 commit comments

Comments
 (0)