Skip to content

Commit

Permalink
update scalafix and sbt-lucuma
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiaggio committed Jun 30, 2023
1 parent 6d796b9 commit 61e98e9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lazy val scala3Version = "3.3.0"
lazy val rulesCrossVersions = Seq(V.scala213)
lazy val allVersions = rulesCrossVersions :+ scala3Version

ThisBuild / tlBaseVersion := "0.31"
ThisBuild / tlBaseVersion := "0.32"
ThisBuild / tlCiReleaseBranches := Seq("master")
ThisBuild / tlJdkRelease := Some(8)
ThisBuild / githubWorkflowJavaVersions := Seq("11", "17").map(JavaSpec.temurin(_))
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/clue/ErrorPolicy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ sealed trait ErrorPolicyProcessor[D, R] {

object ErrorPolicy {
protected sealed trait Distinct[D] extends ErrorPolicyProcessor[D, D] {
protected def processData[F[_]: Applicative, D](data: D): F[D] = Applicative[F].pure(data)
protected def processErrors[F[_]: ApplicativeThrow, D](
protected def processData[F[_]: Applicative](data: D): F[D] = Applicative[F].pure(data)
protected def processErrors[F[_]: ApplicativeThrow](
errors: GraphQLErrors,
data: Option[D] = none
): F[D] =
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/clue/FetchClientImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package clue

import cats.MonadThrow
import cats.syntax.all._
import clue.ErrorPolicyProcessor
import clue.model.GraphQLCombinedResponse
import clue.model.GraphQLRequest
import clue.model.json._
Expand Down
1 change: 0 additions & 1 deletion core/src/main/scala/clue/clients.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package clue

import cats.effect.Resource
import cats.syntax.all._
import clue.ErrorPolicy
import io.circe._
import io.circe.syntax._

Expand Down
9 changes: 6 additions & 3 deletions gen/rules/src/main/scala/clue/gen/GraphQLGenConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import cats.effect.Ref
import cats.effect.kernel.Resource
import cats.syntax.all._
import edu.gemini.grackle.Schema
import metaconfig.ConfDecoder
import metaconfig.generic.Surface

import java.io.File
import java.io.FileInputStream
Expand Down Expand Up @@ -89,7 +91,8 @@ final case class GraphQLGenConfig(
}

object GraphQLGenConfig {
def default = GraphQLGenConfig()
implicit val surface = metaconfig.generic.deriveSurface[GraphQLGenConfig]
implicit val decoder = metaconfig.generic.deriveDecoder(default)
def default: GraphQLGenConfig = GraphQLGenConfig()
implicit val surface: Surface[GraphQLGenConfig] =
metaconfig.generic.deriveSurface[GraphQLGenConfig]
implicit val decoder: ConfDecoder[GraphQLGenConfig] = metaconfig.generic.deriveDecoder(default)
}
26 changes: 23 additions & 3 deletions gen/rules/src/main/scala/clue/gen/QueryGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,15 @@ trait QueryGen extends Generator {
case Term.Param(_, Name(name), _, _) => Term.Name(name)
case other => throw new Exception(s"Unexpected param structure [$other]")
})
val epiParam = List(param"implicit errorPolicy: clue.ErrorPolicy")
// param"implicit errorPolicy: clue.ErrorPolicy"
val epiParam = List(
Term.Param(
mods = List(Mod.Implicit()),
name = Name("errorPolicy"),
decltpe = t"clue.ErrorPolicy".some,
default = none
)
)
val applied =
q"""def apply[F[_]]: clue.ClientAppliedF[F, $schemaType, ClientAppliedFP] =
new clue.ClientAppliedF[F, $schemaType, ClientAppliedFP] {
Expand Down Expand Up @@ -529,8 +537,20 @@ trait QueryGen extends Generator {
"""
)
case _: UntypedSubscription =>
val epiParam = param"implicit errorPolicy: clue.ErrorPolicy"
val clientParam = param"implicit client: clue.StreamingClient[F, $schemaType]"
// param"implicit errorPolicy: clue.ErrorPolicy"
val epiParam = Term.Param(
mods = List(Mod.Implicit()),
name = Name("errorPolicy"),
decltpe = t"clue.ErrorPolicy".some,
default = none
)
// param"implicit client: clue.StreamingClient[F, $schemaType]"
val clientParam = Term.Param(
mods = List(Mod.Implicit()),
name = Name("client"),
decltpe = t"clue.StreamingClient[F, $schemaType]".some,
default = none
)
List(
q"def subscribe[F[_]](...${paramss :+ List(clientParam, epiParam)}) = client.subscribe(this).withInput(Variables(...$variablesNames))"
)
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % "0.10.13")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")
addSbtPlugin("edu.gemini" % "sbt-lucuma-lib" % "0.11.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")

0 comments on commit 61e98e9

Please sign in to comment.