Skip to content

Commit

Permalink
bump plugins (#886)
Browse files Browse the repository at this point in the history
fedefernandez authored Nov 2, 2023
1 parent 54b80e6 commit d807ca1
Showing 3 changed files with 23 additions and 14 deletions.
6 changes: 6 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -7,6 +7,12 @@ runner {
dialect = scala213
}

fileOverride {
"glob:**/github4s/shared/src/test/scala-3/**" {
runner.dialect = scala3
}
}

continuationIndent.callSite = 2

newlines {
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ object ArbitraryDerivation { self =>
object semiauto:
extension (A: Arbitrary.type)
inline def derived[A]: Arbitrary[A] =
import auto.given
summonInline[Arbitrary[A]]

inline def deriveArb[A](using g: K0.Generic[A]): Arbitrary[A] =
@@ -26,20 +25,24 @@ object ArbitraryDerivation { self =>
// https://scastie.scala-lang.org/b8CXWfmXQUClqXplyA6TJg
opaque type DerivedGen[A] = Gen[A]
object DerivedGen extends DerivedGenInstances:
given [A]: Conversion[Gen[A], DerivedGen[A]] = identity
given [A]: Conversion[Gen[A], DerivedGen[A]] = identity
extension [A](gen: DerivedGen[A]) def arb: Arbitrary[A] = Arbitrary(gen)

private final class ArrayProduct(elems: Array[Any]) extends Product:
def canEqual(that: Any): Boolean = true
def productElement(n: Int): Any = elems(n)
def productArity: Int = elems.length
def canEqual(that: Any): Boolean = true
def productElement(n: Int): Any = elems(n)
def productArity: Int = elems.length
override def productIterator: Iterator[Any] = elems.iterator

def product[A](arbs: Seq[Arbitrary[_]])(using gen: K0.ProductGeneric[A]): DerivedGen[A] =
Gen.sequence[Array[Any], Any](arbs.map(_.arbitrary)).map(arr => gen.fromProduct(ArrayProduct(arr)).asInstanceOf[A])
Gen
.sequence[Array[Any], Any](arbs.map(_.arbitrary))
.map(arr => gen.fromProduct(ArrayProduct(arr)).asInstanceOf[A])

def coproduct[A](arbs: => IndexedSeq[Arbitrary[_ <: A]]): DerivedGen[A] =
Gen.lzy(if arbs.isEmpty then Gen.fail else Gen.choose(0, arbs.length - 1).flatMap(arbs(_).arbitrary))
Gen.lzy(
if arbs.isEmpty then Gen.fail else Gen.choose(0, arbs.length - 1).flatMap(arbs(_).arbitrary)
)

sealed abstract class DerivedGenInstances:
inline def summonAllArb[A, U](using gen: K0.Generic[A]): IndexedSeq[Arbitrary[_ <: U]] =
14 changes: 7 additions & 7 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12"
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.8")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.4.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-codecov" % "0.2.1")
addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.11.6")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.11.6")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.11.6")
addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.11.11")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.11.11")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.11.11")
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.2")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.4")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")

0 comments on commit d807ca1

Please sign in to comment.