Skip to content

Commit

Permalink
Merge pull request #78 from SwissDataScienceCenter/update/scala3-libr…
Browse files Browse the repository at this point in the history
…ary-3.4.1

chore: Update scala3-library from 3.3.3 to 3.4.1
  • Loading branch information
eikek authored Mar 28, 2024
2 parents 04d20bf + c017c88 commit 33431df
Show file tree
Hide file tree
Showing 42 changed files with 57 additions and 54 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.github.sbt.git.SbtGit.GitKeys._

organization := "io.renku"
name := "renku-search"
ThisBuild / scalaVersion := "3.3.3"
ThisBuild / scalaVersion := Dependencies.V.scala

// This project contains nothing to package, like pure POM maven project
packagedArtifacts := Map.empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ trait AvroIO extends AvroWriter with AvroReader
object AvroIO:
def apply(schema: Schema): AvroIO =
new AvroIO:
private[this] val reader = AvroReader(schema)
private[this] val writer = AvroWriter(schema)
private val reader = AvroReader(schema)
private val writer = AvroWriter(schema)

override def write[A: AvroEncoder](values: Seq[A]): ByteVector =
writer.write(values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object AvroReader:
def apply(schema: Schema): AvroReader = new Impl(schema)

private class Impl(schema: Schema) extends AvroReader:
private[this] val reader = new GenericDatumReader[Any](schema)
private val reader = new GenericDatumReader[Any](schema)

extension (self: DatumReader[Any])
def readOpt[A: AvroDecoder](decoder: Decoder): Option[A] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object AvroWriter:
new Impl(schema, codecFactory)

private class Impl(schema: Schema, cf: CodecFactory) extends AvroWriter:
private[this] val writer = new GenericDatumWriter[Any](schema)
private val writer = new GenericDatumWriter[Any](schema)

def write[A: AvroEncoder](values: Seq[A]): ByteVector =
write0(out => EncoderFactory.get().binaryEncoder(out, null), values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class ByteVectorInput(val bytes: ByteVector)
extends InputStream
with SeekableInput {

private[this] var position: Long = 0
private var position: Long = 0

override def seek(p: Long): Unit =
position = p
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ object RecordDecoders:
)
}

inline def summonAll[T <: Tuple]: List[AvroDecoder[_]] =
inline def summonAll[T <: Tuple]: List[AvroDecoder[?]] =
inline erasedValue[T] match
case _: EmptyTuple => Nil
case _: (t *: ts) => summonInline[AvroDecoder[t]] :: summonAll[ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ object RecordEncoders {
AvroRecord(schema, fields)
}

inline def summonAll[T <: Tuple]: List[AvroEncoder[_]] =
inline def summonAll[T <: Tuple]: List[AvroEncoder[?]] =
inline erasedValue[T] match
case _: EmptyTuple => Nil
case _: (t *: ts) => summonInline[AvroEncoder[t]] :: summonAll[ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object StreamDecode {
Pull.pure(None)
})

private[this] val curlyClose = Chunk('}'.toByte)
private val curlyClose = Chunk('}'.toByte)
private def decodeCont[A](
decode: Input[Array[Byte]] => DecodingSetup.Sealed[A]
)(input: Chunk[Byte]): Either[Throwable, (Vector[A], Chunk[Byte])] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class RedisQueueClientImpl[F[_]: Async: Log](client: RedisClient)
(rm.body.get(MessageBodyKeys.headers), rm.body.get(MessageBodyKeys.payload))
.mapN(RedisMessage(MessageId(rm.id.value), _, _))

lazy val logInfo: ((XReadMessage[_, _], Option[RedisMessage])) => F[Unit] = {
lazy val logInfo: ((XReadMessage[?, ?], Option[RedisMessage])) => F[Unit] = {
case (m, None) =>
Log[F].info(
s"Message '${m.id}' skipped as it has no '${MessageBodyKeys.headers}' or '${MessageBodyKeys.payload}'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ trait RedisSpec:
: RedisClient => Resource[IO, RedisCommands[IO, String, String]] =
Redis[IO].fromClient(_, RedisCodec.Utf8)

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient)
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ trait QueueSpec extends RedisSpec:
val withQueueClient: QueueFixture = () =>
withRedisClient.asRedisQueueClient().map(new QueueClientImpl[IO](_))

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient)
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ private class GitLabDocsCreator[F[_]: Async: ModelTypesGenerators](
.evalMap(getProjectUsers(projectId, _))
.takeWhile(_.nonEmpty)
.flatMap(Stream.emits)
.filterNot(_.name contains "_bot_")
.filterNot(_.name contains "****")
.filterNot(_.name `contains` "_bot_")
.filterNot(_.name `contains` "****")
.map(toUser)

private def getProjectUsers(id: Int, page: Int) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ final class MessageHandlers[F[_]: Async](
steps: QueueName => PipelineSteps[F],
cfg: QueuesConfig
) extends ShowInstances:
private[this] var tasks: Map[String, F[Unit]] = Map.empty
private[this] def add(queue: QueueName, task: Stream[F, Unit]): Stream[F, Unit] =
private var tasks: Map[String, F[Unit]] = Map.empty
private def add(queue: QueueName, task: Stream[F, Unit]): Stream[F, Unit] =
tasks = tasks.updated(queue.name, task.compile.drain)
task

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import io.renku.redis.client.QueueName

private class QueueSizeGauge extends QueueGauge:

private[this] val underlying =
private val underlying =
Gauge
.build()
.name("redis_stream_size")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import io.renku.redis.client.QueueName

private class UnprocessedCountGauge extends QueueGauge:

private[this] val underlying =
private val underlying =
Gauge
.build()
.name("redis_stream_unprocessed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AuthorizationAddedProvisioningSpec extends ProvisioningSuite:
}
}

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)

object AuthorizationAddedProvisioningSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class AuthorizationRemovedProvisioningSpec extends ProvisioningSuite:
}
}

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)

object AuthorizationRemovedProvisioningSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AuthorizationUpdatedProvisioningSpec extends ProvisioningSuite:
}
}

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)

object AuthorizationUpdatedProvisioningSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class ProjectCreatedProvisioningSpec extends ProvisioningSuite:
yield ()
}

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)

object ProjectCreatedProvisioningSpec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ class ProjectRemovedProcessSpec extends ProvisioningSuite:

private lazy val queryProjects = Query(typeIs(EntityType.Project))

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ class ProjectUpdatedProvisioningSpec extends ProvisioningSuite:
_.to[ProjectUpdated]
)

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ class UserAddedProvisioningSpec extends ProvisioningSuite:
yield ()
}

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ class UserRemovedProcessSpec extends ProvisioningSuite:
yield ()
}

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ class UserUpdatedProvisioningSpec extends ProvisioningSuite:
ua => UserUpdated(ua.id, ua.firstName, ua.lastName, ua.email)
)

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withRedisClient, withQueueClient, withSearchSolrClient)
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Field:
given Encoder[Field] = Encoder.forString.contramap(_.name)
given Decoder[Field] = Decoder.forString.mapEither(fromString)

private[this] val allNames: String = Field.values.map(_.name).mkString(", ")
private val allNames: String = Field.values.map(_.name).mkString(", ")

def fromString(str: String): Either[String, Field] =
Field.values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ object Query:
Segment.Field(Created(Comparison.GreaterThan, NonEmptyList(date, dates.toList)))

def creationDateIs(date: PartialDateTime, dates: PartialDateTime*): Segment =
creationDateIs(DateTimeRef(date), dates.map(DateTimeRef.apply): _*)
creationDateIs(DateTimeRef(date), dates.map(DateTimeRef.apply)*)

def creationDateGt(date: PartialDateTime, dates: PartialDateTime*): Segment =
creationDateGt(DateTimeRef(date), dates.map(DateTimeRef.apply): _*)
creationDateGt(DateTimeRef(date), dates.map(DateTimeRef.apply)*)

def creationDateLt(date: PartialDateTime, dates: PartialDateTime*): Segment =
creationDateLt(DateTimeRef(date), dates.map(DateTimeRef.apply): _*)
creationDateLt(DateTimeRef(date), dates.map(DateTimeRef.apply)*)

val empty: Query = Query(Nil)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object SortableField:
given Decoder[SortableField] = Decoder.forString.mapEither(fromString)
given Order[SortableField] = Order.by(_.name)

private[this] val allNames: String = SortableField.values.map(_.name).mkString(", ")
private val allNames: String = SortableField.values.map(_.name).mkString(", ")

def fromString(str: String): Either[String, SortableField] =
SortableField.values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import io.renku.solr.client.schema.FieldName
private class SearchSolrClientImpl[F[_]: Async](solrClient: SolrClient[F])
extends SearchSolrClient[F]:

private[this] val logger = scribe.cats.effect[F]
private[this] val interpreter = LuceneQueryInterpreter.forSync[F]
private val logger = scribe.cats.effect[F]
private val interpreter = LuceneQueryInterpreter.forSync[F]

private val typeTerms = Facet.Terms(
EntityDocumentSchema.Fields.entityType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private object SolrSortCreate:
case Order.Direction.Desc => SolrSort.Direction.Desc

def apply(ts: Order.OrderedBy*): SolrSort =
SolrSort(ts.map(e => (fromField(e.field), fromDirection(e.direction))): _*)
SolrSort(ts.map(e => (fromField(e.field), fromDirection(e.direction)))*)

def apply(ts: NonEmptyList[Order.OrderedBy]): SolrSort =
apply(ts.toList: _*)
apply(ts.toList*)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private[query] object StringEscape:
// Escapes query characters for solr. This is taken from here:
// https://github.com/apache/solr/blob/bcb9f144974ed07aa3b66766302474542067b522/solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java#L163
// to not introduce too many dependencies only for this little function
private[this] val defaultSpecialChars = "\\+-!():^[]\"{}~*?|&;/"
private val defaultSpecialChars = "\\+-!():^[]\"{}~*?|&;/"

def escape(s: String, specialChars: String): String =
inline def isSpecial(c: Char) = c.isWhitespace || specialChars.contains(c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ abstract class SearchSolrSuite extends SolrClientBaseSuite:
override def afterAll(): Unit =
server.stop()

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withSearchSolrClient)
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final case class AuthTestData(
copy(projects = projects.updated(key, p))

def queryAll =
Query(Query.Segment.idIs(all.head.id.value, all.tail.map(_.id.value): _*))
Query(Query.Segment.idIs(all.head.id.value, all.tail.map(_.id.value)*))

def user1EntityIds =
users.map(_.id) ++ List(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private[client] object DeleteIdRequest:
given Encoder[DeleteIdRequest] =
new Encoder[DeleteIdRequest]:
override def write(w: Writer, value: DeleteIdRequest) =
w.writeMap(Map("delete" -> value.ids.toList))(
w.writeMap(Map("delete" -> value.ids.toList))(using
Encoder[String],
Encoder[List[String]]
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ private[client] object DeleteRequest:
val e: Encoder[DeleteRequest] = deriveEncoder[DeleteRequest]
new Encoder[DeleteRequest]:
override def write(w: Writer, value: DeleteRequest) =
w.writeMap(Map("delete" -> value))(Encoder[String], e)
w.writeMap(Map("delete" -> value))(using Encoder[String], e)
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object EncoderSupport {
inline def deriveWithAdditional[A <: Product, V: Encoder](field: (String, V)*)(using
Mirror.Of[A]
): Encoder[A] =
val adds = AdditionalFields.const[A, V](field: _*)
val adds = AdditionalFields.const[A, V](field*)
Macros.createEncoder[String, V, A](adds)

private object Macros {
Expand Down Expand Up @@ -111,7 +111,7 @@ object EncoderSupport {
w.writeMapOpen(names.size + additionalProps.size)
additionalProps.foreach { case (k, v) => w.writeMapMember(k, v) }
names.zip(values).zip(encoders).foreach { case ((k, v), e) =>
w.writeMapMember(k, v)(Encoder[String], e.asInstanceOf[Encoder[Any]])
w.writeMapMember(k, v)(using Encoder[String], e.asInstanceOf[Encoder[Any]])
}
w.writeMapClose()

Expand All @@ -125,7 +125,7 @@ object EncoderSupport {
encoders(ord).asInstanceOf[Encoder[Any]].write(w, value)
}

inline def summonEncoder[A <: Tuple]: List[Encoder[_]] =
inline def summonEncoder[A <: Tuple]: List[Encoder[?]] =
inline erasedValue[A] match
case _: EmptyTuple => Nil
case _: (t *: ts) => summonInline[Encoder[t]] :: summonEncoder[ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ private class SolrClientImpl[F[_]: Async](config: SolrConfig, underlying: Client
with SchemaJsonCodec
with BorerEntityJsonCodec
with SolrEntityCodec:
private[this] val logger = scribe.cats.effect[F]
private[this] val solrUrl: Uri = config.baseUrl / config.core
private val logger = scribe.cats.effect[F]
private val solrUrl: Uri = config.baseUrl / config.core

def modifySchema(cmds: Seq[SchemaCommand], onErrorLog: ResponseLogging): F[Unit] =
val req = Method
Expand Down Expand Up @@ -84,7 +84,7 @@ private class SolrClientImpl[F[_]: Async](config: SolrConfig, underlying: Client

override def findById[A: Decoder](id: String, other: String*): F[GetByIdResponse[A]] =
val req = Method
.GET(makeGetByIdUrl(NonEmptyList.of(id, other: _*)))
.GET(makeGetByIdUrl(NonEmptyList.of(id, other*)))
.withBasicAuth(credentials)
underlying.fetchAs[GetByIdResponse[A]](req)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ object SchemaMigrator:
SolrClient[F](solrConfig).map(apply[F])

private class Impl[F[_]: Sync](client: SolrClient[F]) extends SchemaMigrator[F] {
private[this] val logger = scribe.cats.effect[F]
private[this] val versionDocId = "VERSION_ID_EB779C6B-1D96-47CB-B304-BECF15E4A607"
private[this] val versionTypeName: TypeName = TypeName("plong")
private val logger = scribe.cats.effect[F]
private val versionDocId = "VERSION_ID_EB779C6B-1D96-47CB-B304-BECF15E4A607"
private val versionTypeName: TypeName = TypeName("plong")

override def currentVersion: F[Option[Long]] =
client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ trait SchemaJsonCodec {
override def write(w: Writer, value: Seq[SchemaCommand]) =
w.writeMapOpen(value.size)
value.foreach { v =>
w.writeMapMember(v.commandName, v)(
w.writeMapMember(v.commandName, v)(using
Encoder[String],
commandPayloadEncoder
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ object SolrClientGenerator:
val facets: Gen[Facets] =
Gen.choose(0, 5).flatMap(n => Gen.listOfN(n, facet)).map { n =>
if (n.isEmpty) Facets.empty
else Facets(n: _*)
else Facets(n*)
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ trait SolrServerSuite:
override def afterAll(): Unit =
server.stop()

override def munitFixtures: Seq[Fixture[_]] =
override def munitFixtures: Seq[Fixture[?]] =
List(withSolrClient)
2 changes: 2 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ object Dependencies {
val http4s = "0.23.26"
val http4sPrometheusMetrics = "0.24.6"
val redis4Cats = "1.6.0"
val sbtMdoc = "2.5.2"
val scala = "3.4.1"
val scalacheckEffectMunit = "1.0.4"
val scodec = "2.2.2"
val scodecBits = "1.1.38"
Expand Down
Loading

0 comments on commit 33431df

Please sign in to comment.