Skip to content

Commit

Permalink
Bump scala version to 2.13.9
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Sep 30, 2022
1 parent fa54007 commit 1aac5a9
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 26 deletions.
Expand Up @@ -196,13 +196,13 @@ object Type {
* Check enum contains some different types
* (string and number or number and boolean)
*/
private def isComplexEnum(enum: List[Json]) = {
private def isComplexEnum(`enum`: List[Json]) = {
// Predicates
def isNumeric(s: Json) = s.isNumber
def isNonNumeric(s: Json) = !isNumeric(s)
def isBoolean(s: Json) = s.isBoolean

val nonNullEnum = excludeNull(enum)
val nonNullEnum = excludeNull(`enum`)
somePredicates(nonNullEnum, List(isNumeric _, isNonNumeric _, isBoolean _), 2)
}

Expand All @@ -228,26 +228,26 @@ object Type {
case _ :: tail => somePredicates(instances, tail, quantity)
}

private def isIntegerEnum(enum: List[Json]): Boolean =
excludeNull(enum) match {
private def isIntegerEnum(`enum`: List[Json]): Boolean =
excludeNull(`enum`) match {
case Nil => false
case values => values.forall(_.asNumber.flatMap(_.toInt).isDefined)
}

private def isBigIntEnum(enum: List[Json]): Boolean =
excludeNull(enum) match {
private def isBigIntEnum(`enum`: List[Json]): Boolean =
excludeNull(`enum`) match {
case Nil => false
case values => values.forall(_.asNumber.flatMap(_.toLong).isDefined)
}

private def isBooleanEnum(enum: List[Json]): Boolean =
excludeNull(enum) match {
private def isBooleanEnum(`enum`: List[Json]): Boolean =
excludeNull(`enum`) match {
case Nil => false
case values => values.forall(_.isBoolean)
}

private def isStringEnum(enum: List[Json]): Boolean =
excludeNull(enum) match {
private def isStringEnum(`enum`: List[Json]): Boolean =
excludeNull(`enum`) match {
case Nil => false
case values => values.forall(_.isString)
}
Expand Down
Expand Up @@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets
import cats.data.{EitherT, NonEmptyList}
import cats.implicits._

import cats.effect.{Clock, ContextShift, Sync}
import cats.effect.{Clock, Sync}

import doobie._
import doobie.implicits._
Expand All @@ -43,7 +43,7 @@ object Sink {

type Insert = ConnectionIO[Unit]

def sinkResult[F[_]: Sync: ContextShift: Clock: DB](
def sinkResult[F[_]: Sync: Clock: DB](
state: State[F],
client: Client[F, Json],
processor: Processor,
Expand Down Expand Up @@ -93,7 +93,7 @@ object Sink {
result.value
}

def bad[F[_]: Sync](badRow: BadRow, badSink: StreamSink[F]): F[Unit] =
def bad[F[_]](badRow: BadRow, badSink: StreamSink[F]): F[Unit] =
badSink(badRow.compact.getBytes(StandardCharsets.UTF_8))
/**
* Build an `INSERT` action for a single entity
Expand Down
Expand Up @@ -84,8 +84,9 @@ class StateSpec extends Specification with ScalaCheck {
result.unsafeRunSync() must beLike {
case ((counter, keys), time) =>
val totalDelays = durations.foldMap(_.toMillis)
val allBlocking = time must beBetween(totalDelays, totalDelays * 2)
allBlocking.and(counter must beEqualTo(durations.length)).and(keys must beEqualTo(Set(key)))
time must beBetween(totalDelays, totalDelays * 2)
counter must beEqualTo(durations.length)
keys must beEqualTo(Set(key))
}
}
.setParameters(Parameters(minTestsOk = 5, maxSize = 10))
Expand All @@ -109,8 +110,9 @@ class StateSpec extends Specification with ScalaCheck {
result.unsafeRunSync() must beLike {
case ((counter, keys), time) =>
val maxDelay = durations.fold(5.millis)((a, b) => a.max(b)).toMillis
val nonBlocking = time must lessThan(maxDelay * 2)
nonBlocking.and(counter must beEqualTo(durations.length)).and(keys must beEqualTo(Set()))
time must lessThan(maxDelay * 2)
counter must beEqualTo(durations.length)
keys must beEqualTo(Set())
}
}
.setParameters(Parameters(minTestsOk = 5, maxSize = 10))
Expand Down
Expand Up @@ -21,7 +21,7 @@ import scala.concurrent.ExecutionContext
import cats.data.{EitherT, ValidatedNel}
import cats.implicits._

import cats.effect.{Async, Clock, ContextShift, Sync}
import cats.effect.{Async, ContextShift, Sync}

import com.typesafe.config.{Config => LightbendConfig, ConfigFactory}

Expand Down Expand Up @@ -49,7 +49,7 @@ object Cli {
val processor = Processor(BuildInfo.name, BuildInfo.version)

/** Parse list of arguments, validate against schema and initialize */
def parse[F[_]: Async: Clock](args: List[String]): EitherT[F, String, Cli[F]] =
def parse[F[_]: Async](args: List[String]): EitherT[F, String, Cli[F]] =
command.parse(args) match {
case Left(help) => EitherT.leftT[F, Cli[F]](help.show)
case Right(rawConfig) => fromRawConfig(rawConfig)
Expand All @@ -76,7 +76,7 @@ object Cli {
private def fileExists[F[_]: Async](pathInfo: PathInfo): F[Boolean] =
Sync[F].delay(Files.exists(pathInfo.allPath))

private def fromRawConfig[F[_]: Async: Clock](rawConfig: RawConfig): EitherT[F, String, Cli[F]] =
private def fromRawConfig[F[_]: Async](rawConfig: RawConfig): EitherT[F, String, Cli[F]] =
for {
resolverJson <- loadJson(rawConfig.resolver).toEitherT[F]
igluClient <- Client.parseDefault[F](resolverJson).leftMap(_.show)
Expand Down
Expand Up @@ -14,7 +14,7 @@ package com.snowplowanalytics.snowplow.postgres.env.local

import cats.Applicative
import cats.implicits._
import cats.effect.{ContextShift, Blocker, Resource, Timer, ConcurrentEffect}
import cats.effect.{ContextShift, Blocker, Resource, ConcurrentEffect}

import fs2.{Pipe, Stream}

Expand All @@ -28,7 +28,7 @@ import com.snowplowanalytics.snowplow.postgres.env.Environment

object LocalEnv {

def create[F[_]: ConcurrentEffect : ContextShift : Timer](blocker: Blocker, config: Source.Local, badSink: StreamSink[F]): Resource[F, Environment[F, String]] = {
def create[F[_]: ConcurrentEffect : ContextShift](blocker: Blocker, config: Source.Local, badSink: StreamSink[F]): Resource[F, Environment[F, String]] = {
Resource.eval {
ConcurrentEffect[F].delay(
Environment[F, String](
Expand All @@ -42,7 +42,7 @@ object LocalEnv {
}
}

private def getSource[F[_]: ConcurrentEffect : ContextShift : Timer](blocker: Blocker, config: Source.Local): Stream[F, String] = {
private def getSource[F[_]: ConcurrentEffect : ContextShift](blocker: Blocker, config: Source.Local): Stream[F, String] = {
val store: Store[F] = FileStore[F](config.path.pathType.fsroot, blocker)
store.list(config.path.value, recursive = true)
.flatMap { p =>
Expand Down
Expand Up @@ -14,7 +14,7 @@ package com.snowplowanalytics.snowplow.postgres.env.pubsub

import cats.Applicative
import cats.implicits._
import cats.effect.{ContextShift, Blocker, Resource, Timer, ConcurrentEffect, Sync}
import cats.effect.{ContextShift, Blocker, Resource, ConcurrentEffect, Sync}

import fs2.Pipe

Expand All @@ -36,7 +36,7 @@ object PubSubEnv {

private lazy val logger = getLogger

def create[F[_]: ConcurrentEffect: ContextShift: Timer](blocker: Blocker, config: Source.PubSub, badSink: StreamSink[F]): Resource[F, Environment[F, ConsumerRecord[F, String]]] = {
def create[F[_]: ConcurrentEffect: ContextShift](blocker: Blocker, config: Source.PubSub, badSink: StreamSink[F]): Resource[F, Environment[F, ConsumerRecord[F, String]]] = {
implicit val decoder: MessageDecoder[String] = pubsubDataDecoder
val project = ProjectId(config.projectId)
val subscription = Subscription(config.subscriptionId)
Expand Down
2 changes: 1 addition & 1 deletion project/BuildSettings.scala
Expand Up @@ -28,7 +28,7 @@ import scoverage.ScoverageKeys._

object BuildSettings {
val scala212 = "2.12.11"
val scala213 = "2.13.3"
val scala213 = "2.13.9"

lazy val projectSettings = Seq(
organization := "com.snowplowanalytics",
Expand Down

0 comments on commit 1aac5a9

Please sign in to comment.