diff --git a/modules/cloudutils/aws/src/main/scala/com/snowplowanalytics/snowplow/enrich/aws/S3Client.scala b/modules/cloudutils/aws/src/main/scala/com/snowplowanalytics/snowplow/enrich/aws/S3Client.scala index d5c7da502..608d47092 100644 --- a/modules/cloudutils/aws/src/main/scala/com/snowplowanalytics/snowplow/enrich/aws/S3Client.scala +++ b/modules/cloudutils/aws/src/main/scala/com/snowplowanalytics/snowplow/enrich/aws/S3Client.scala @@ -31,7 +31,7 @@ object S3Client { def mk[F[_]: Async]: Resource[F, Client[F]] = for { - s3Client <- Resource.fromAutoCloseable(Sync[F].delay(S3AsyncClient.builder().region(getRegion).build())) + s3Client <- Resource.fromAutoCloseable(Sync[F].delay(S3AsyncClient.builder().region(getRegion()).build())) store <- Resource.eval(S3Store.builder[F](s3Client).build.toEither.leftMap(_.head).pure[F].rethrow) } yield new Client[F] { def canDownload(uri: URI): Boolean = diff --git a/modules/common-fs2/src/it/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/test/CollectorPayloadGen.scala b/modules/common-fs2/src/it/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/test/CollectorPayloadGen.scala index f8c9157d5..f32aaea2c 100644 --- a/modules/common-fs2/src/it/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/test/CollectorPayloadGen.scala +++ b/modules/common-fs2/src/it/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/test/CollectorPayloadGen.scala @@ -27,7 +27,7 @@ import org.apache.thrift.TSerializer import java.util.Base64 -import com.snowplowanalytics.iglu.core.{ SelfDescribingData, SchemaKey, SchemaVer } +import com.snowplowanalytics.iglu.core.{SchemaKey, SchemaVer, SelfDescribingData} import com.snowplowanalytics.iglu.core.circe.CirceIgluCodecs._ import com.snowplowanalytics.snowplow.enrich.common.loaders.CollectorPayload @@ -40,7 +40,9 @@ object CollectorPayloadGen { generateRaw(nbGoodEvents, nbBadRows).map(_.toThrift).map(new TSerializer().serialize) def generateRaw[F[_]: Sync](nbGoodEvents: Long, nbBadRows: Long): Stream[F, CollectorPayload] = - Stream.repeatEval(runGen(collectorPayloadGen(true))).take(nbGoodEvents) ++ Stream.repeatEval(runGen(collectorPayloadGen(false))).take(nbBadRows) + Stream.repeatEval(runGen(collectorPayloadGen(true))).take(nbGoodEvents) ++ Stream + .repeatEval(runGen(collectorPayloadGen(false))) + .take(nbBadRows) private def collectorPayloadGen(valid: Boolean): Gen[CollectorPayload] = for { @@ -74,46 +76,74 @@ object CollectorPayloadGen { aid <- Gen.const("enrich-kinesis-integration-tests").withKey("aid") e <- Gen.const("ue").withKey("e") tv <- Gen.oneOf("scala-tracker_1.0.0", "js_2.0.0", "go_1.2.3").withKey("tv") - uePx <- - if(valid) - ueGen.map(_.toString).map(str => base64Encoder.encodeToString(str.getBytes)).withKey("ue_px") - else - Gen.const("foo").withKey("ue_px") + uePx <- if (valid) + ueGen.map(_.toString).map(str => base64Encoder.encodeToString(str.getBytes)).withKey("ue_px") + else + Gen.const("foo").withKey("ue_px") } yield SelfDescribingData( - SchemaKey("com.snowplowanalytics.snowplow", "payload_data", "jsonschema", SchemaVer.Full(1,0,4)), - List(asObject(List(p, aid, e, uePx, tv))).asJson + SchemaKey("com.snowplowanalytics.snowplow", "payload_data", "jsonschema", SchemaVer.Full(1, 0, 4)), + List(asObject(List(p, aid, e, uePx, tv))).asJson ).asJson.toString private def ueGen = for { sdj <- Gen.oneOf(changeFormGen, clientSessionGen) } yield SelfDescribingData( - SchemaKey("com.snowplowanalytics.snowplow", "unstruct_event", "jsonschema", SchemaVer.Full(1,0,0)), + SchemaKey("com.snowplowanalytics.snowplow", "unstruct_event", "jsonschema", SchemaVer.Full(1, 0, 0)), sdj.asJson ).asJson - private def changeFormGen = for { - formId <- strGen(32, Gen.alphaNumChar).withKey("formId") + formId <- strGen(32, Gen.alphaNumChar).withKey("formId") elementId <- strGen(32, Gen.alphaNumChar).withKey("elementId") - nodeName <- Gen.oneOf(List("INPUT", "TEXTAREA", "SELECT")).withKey("nodeName") - `type` <- Gen.option(Gen.oneOf(List("button", "checkbox", "color", "date", "datetime", "datetime-local", "email", "file", "hidden", "image", "month", "number", "password", "radio", "range", "reset", "search", "submit", "tel", "text", "time", "url", "week"))).withKeyOpt("type") - value <- Gen.option(strGen(16, Gen.alphaNumChar)).withKeyNull("value") + nodeName <- Gen.oneOf(List("INPUT", "TEXTAREA", "SELECT")).withKey("nodeName") + `type` <- Gen + .option( + Gen.oneOf( + List( + "button", + "checkbox", + "color", + "date", + "datetime", + "datetime-local", + "email", + "file", + "hidden", + "image", + "month", + "number", + "password", + "radio", + "range", + "reset", + "search", + "submit", + "tel", + "text", + "time", + "url", + "week" + ) + ) + ) + .withKeyOpt("type") + value <- Gen.option(strGen(16, Gen.alphaNumChar)).withKeyNull("value") } yield SelfDescribingData( - SchemaKey("com.snowplowanalytics.snowplow", "change_form", "jsonschema", SchemaVer.Full(1,0,0)), + SchemaKey("com.snowplowanalytics.snowplow", "change_form", "jsonschema", SchemaVer.Full(1, 0, 0)), asObject(List(formId, elementId, nodeName, `type`, value)) ) private def clientSessionGen = for { - userId <- Gen.uuid.withKey("userId") - sessionId <- Gen.uuid.withKey("sessionId") - sessionIndex <- Gen.choose(0, 2147483647).withKey("sessionIndex") + userId <- Gen.uuid.withKey("userId") + sessionId <- Gen.uuid.withKey("sessionId") + sessionIndex <- Gen.choose(0, 2147483647).withKey("sessionIndex") previousSessionId <- Gen.option(Gen.uuid).withKeyNull("previousSessionId") - storageMechanism <- Gen.oneOf(List("SQLITE", "COOKIE_1", "COOKIE_3", "LOCAL_STORAGE", "FLASH_LSO")).withKey("storageMechanism") + storageMechanism <- Gen.oneOf(List("SQLITE", "COOKIE_1", "COOKIE_3", "LOCAL_STORAGE", "FLASH_LSO")).withKey("storageMechanism") } yield SelfDescribingData( - SchemaKey("com.snowplowanalytics.snowplow", "client_session", "jsonschema", SchemaVer.Full(1,0,1)), + SchemaKey("com.snowplowanalytics.snowplow", "client_session", "jsonschema", SchemaVer.Full(1, 0, 1)), asObject(List(userId, sessionId, sessionIndex, previousSessionId, storageMechanism)) ) @@ -159,7 +189,7 @@ object CollectorPayloadGen { implicit class GenOps[A](gen: Gen[A]) { def withKey[B](name: String)(implicit enc: Encoder[A]): Gen[Option[(String, Json)]] = - gen.map { a => Some((name -> a.asJson)) } + gen.map(a => Some((name -> a.asJson))) } implicit class GenOptOps[A](gen: Gen[Option[A]]) { diff --git a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Assets.scala b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Assets.scala index 90dba7903..25411007d 100644 --- a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Assets.scala +++ b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Assets.scala @@ -14,7 +14,6 @@ import java.net.URI import scala.concurrent.ExecutionContext import scala.concurrent.duration._ -import scala.util.control.NonFatal import cats.Applicative import cats.implicits._ @@ -259,8 +258,7 @@ object Assets { def worthRetrying[F[_]: Applicative](e: Throwable): F[Boolean] = e match { case _: Clients.RetryableFailure => Applicative[F].pure(true) - case _: IllegalArgumentException => Applicative[F].pure(false) - case NonFatal(_) => Applicative[F].pure(false) + case _ => Applicative[F].pure(false) } def onError[F[_]: Sync](error: Throwable, details: RetryDetails): F[Unit] = diff --git a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Enrich.scala b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Enrich.scala index 89753726b..c6719960f 100644 --- a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Enrich.scala +++ b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Enrich.scala @@ -152,7 +152,7 @@ object Enrich { payload.fold(_.asJson.noSpaces, _.map(_.toBadRowPayload.asJson.noSpaces).getOrElse("None")) /** Log an error, turn the problematic `CollectorPayload` into `BadRow` and notify Sentry if configured */ - def sendToSentry[F[_]: Sync: Clock]( + def sendToSentry[F[_]: Sync]( original: Array[Byte], sentry: Option[SentryClient], processor: Processor, diff --git a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Run.scala b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Run.scala index 746c582af..cdc76b447 100644 --- a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Run.scala +++ b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/Run.scala @@ -18,8 +18,6 @@ import cats.implicits._ import fs2.Stream -import scala.concurrent.ExecutionContext - import cats.effect.kernel.{Async, Resource, Sync} import cats.effect.ExitCode diff --git a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/io/FileSystem.scala b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/io/FileSystem.scala index 0d72eb666..23e4159fa 100644 --- a/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/io/FileSystem.scala +++ b/modules/common-fs2/src/main/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/io/FileSystem.scala @@ -12,7 +12,7 @@ package com.snowplowanalytics.snowplow.enrich.common.fs2.io import java.nio.file.{Files, Path} -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.io.{Source => SSource} import cats.data.EitherT diff --git a/modules/common-fs2/src/test/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/blackbox/BlackBoxTesting.scala b/modules/common-fs2/src/test/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/blackbox/BlackBoxTesting.scala index b20a225ca..dedcd02f8 100644 --- a/modules/common-fs2/src/test/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/blackbox/BlackBoxTesting.scala +++ b/modules/common-fs2/src/test/scala/com/snowplowanalytics/snowplow/enrich/common/fs2/blackbox/BlackBoxTesting.scala @@ -10,7 +10,7 @@ */ package com.snowplowanalytics.snowplow.enrich.common.fs2.blackbox -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import org.specs2.mutable.Specification diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/Adapter.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/Adapter.scala index c9f551ebb..566aecd30 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/Adapter.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/Adapter.scala @@ -165,7 +165,7 @@ trait Adapter { formatter: FormatterFunc, platform: String ): RawEventParameters = { - val params = formatter(parameters - ("nuid", "aid", "cv", "p")) + val params = formatter(parameters -- List("nuid", "aid", "cv", "p")) val json = toUnstructEvent(SelfDescribingData(schema, params)).noSpaces buildUnstructEventParams(tracker, platform, parameters, json) } @@ -182,7 +182,7 @@ trait Adapter { "p" -> parameters.getOrElse("p", Option(platform)), // Required field "ue_pr" -> Option(json) ) ++ - parameters.filterKeys(AcceptedQueryParameters) + parameters.view.filterKeys(AcceptedQueryParameters).toMap /** * Creates a Snowplow unstructured event by nesting the provided JValue in a self-describing @@ -375,7 +375,7 @@ trait Adapter { */ private[registry] def camelCase(snakeOrDash: String) = snakeCaseOrDashTokenCapturingRegex.replaceAllIn( - Character.toLowerCase(snakeOrDash.charAt(0)) + snakeOrDash.substring(1), + Character.toString(Character.toLowerCase(snakeOrDash.charAt(0))) + snakeOrDash.substring(1), m => m.group(1).capitalize ) diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/GoogleAnalyticsAdapter.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/GoogleAnalyticsAdapter.scala index ecd0fa344..999fd31ad 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/GoogleAnalyticsAdapter.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/GoogleAnalyticsAdapter.scala @@ -12,7 +12,7 @@ package com.snowplowanalytics.snowplow.enrich.common.adapters.registry import scala.annotation.tailrec -import cats.{Applicative, Functor, Monad} +import cats.{Applicative, Monad} import cats.data.{NonEmptyList, ValidatedNel} import cats.implicits._ @@ -531,7 +531,7 @@ case class GoogleAnalyticsAdapter(schemas: GoogleAnalyticsSchemas) extends Adapt ) schemaVal = lookupSchema( hitType.some, - unstructEventData.mapValues(_.schemaKey) + unstructEventData.view.mapValues(_.schemaKey).toMap ).toValidatedNel simpleContexts = buildContexts(params, contextData, fieldToSchemaMap) compositeContexts = buildCompositeContexts( @@ -675,7 +675,9 @@ case class GoogleAnalyticsAdapter(schemas: GoogleAnalyticsSchemas) extends Adapt // composite params have digits in their key composite <- originalParams .collect { case (k, Some(v)) => (k, v) } + .view .filterKeys(k => k.exists(_.isDigit)) + .toMap .asRight brokenDown <- composite.toList.sorted.map { case (k, v) => breakDownCompField(k, v, indicator) @@ -684,7 +686,9 @@ case class GoogleAnalyticsAdapter(schemas: GoogleAnalyticsSchemas) extends Adapt // we additionally make sure we have a rectangular dataset grouped = (partitioned._2 ++ removeConsecutiveDuplicates(partitioned._1)).flatten .groupBy(_._1) + .view .mapValues(_.map(_._2)) + .toMap translated <- { val m = grouped .foldLeft( @@ -821,7 +825,7 @@ case class GoogleAnalyticsAdapter(schemas: GoogleAnalyticsSchemas) extends Adapt case head => head :: transpose(l.collect { case _ :: tail => tail }) } - private def traverseMap[G[_]: Functor: Applicative, K, V](m: Map[K, G[V]]): G[Map[K, V]] = + private def traverseMap[G[_]: Applicative, K, V](m: Map[K, G[V]]): G[Map[K, V]] = m.toList .traverse { case (name, vnel) => diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/OlarkAdapter.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/OlarkAdapter.scala index 0a5c03e0f..338f463a5 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/OlarkAdapter.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/OlarkAdapter.scala @@ -13,7 +13,7 @@ package com.snowplowanalytics.snowplow.enrich.common.adapters.registry import java.net.URI import java.nio.charset.StandardCharsets.UTF_8 -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.{Try, Success => TS, Failure => TF} import cats.Monad diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/StatusGatorAdapter.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/StatusGatorAdapter.scala index 84f308957..a62151df2 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/StatusGatorAdapter.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/StatusGatorAdapter.scala @@ -13,7 +13,7 @@ package com.snowplowanalytics.snowplow.enrich.common.adapters.registry import java.net.URI import java.nio.charset.StandardCharsets.UTF_8 -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.{Try, Success => TS, Failure => TF} import cats.Monad diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/UnbounceAdapter.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/UnbounceAdapter.scala index b2a3b86eb..30b5736fc 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/UnbounceAdapter.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/UnbounceAdapter.scala @@ -13,7 +13,7 @@ package com.snowplowanalytics.snowplow.enrich.common.adapters.registry import java.net.URI import java.nio.charset.StandardCharsets.UTF_8 -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.{Try, Success => TS, Failure => TF} import cats.Monad diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/snowplow/RedirectAdapter.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/snowplow/RedirectAdapter.scala index 588f27022..c6e95e490 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/snowplow/RedirectAdapter.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/adapters/registry/snowplow/RedirectAdapter.scala @@ -98,6 +98,7 @@ object RedirectAdapter extends Adapter { case (None, Some(Some(co))) if co == "" => newCo.asRight case (None, Some(Some(co))) => addToExistingCo(json, co).map(str => Map("co" -> str)) case (Some(Some(cx)), _) => addToExistingCx(json, cx).map(str => Map("cx" -> str)) + case other => throw new IllegalStateException(s"Illegal state: $other") } } else // Add URI redirect as an unstructured event diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentManager.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentManager.scala index 1d238fdc2..c47143103 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentManager.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/EnrichmentManager.scala @@ -287,7 +287,7 @@ object EnrichmentManager { def setCollectorTstamp(event: EnrichedEvent, timestamp: Option[DateTime]): Either[FailureDetails.EnrichmentFailure, Unit] = EE.formatCollectorTstamp(timestamp).map { t => event.collector_tstamp = t - ().asRight + () } def setUseragent( diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/AnonIpEnrichment.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/AnonIpEnrichment.scala index be2342ae9..7a5fa9bf3 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/AnonIpEnrichment.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/AnonIpEnrichment.scala @@ -150,6 +150,7 @@ final case class AnonIpEnrichment(ipv4Octets: AnonIPv4Octets.AnonIPv4Octets, ipv .map { case _: Inet4Address => anonymizeIpV4(ip) case ipv6: Inet6Address => anonymizeIpV6(ipv6.getHostAddress) + case _ => throw new IllegalStateException(s"Illegal state") } .getOrElse(tryAnonymizingInvalidIp(ip)) }.orNull diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/YauaaEnrichment.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/YauaaEnrichment.scala index 55127907c..13d28d42b 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/YauaaEnrichment.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/YauaaEnrichment.scala @@ -10,7 +10,7 @@ */ package com.snowplowanalytics.snowplow.enrich.common.enrichments.registry -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import cats.data.ValidatedNel import cats.syntax.either._ @@ -64,7 +64,7 @@ object YauaaEnrichment extends ParseableEnrichment { s match { case _ if s.isEmpty => s case _ if s.length == 1 => s.toLowerCase - case _ => s.charAt(0).toLower + s.substring(1) + case _ => Character.toString(s.charAt(0).toLower) + s.substring(1) } } @@ -112,7 +112,9 @@ final case class YauaaEnrichment(cacheSize: Option[Int]) extends Enrichment { parsedUA.getAvailableFieldNamesSorted.asScala .map(field => decapitalize(field) -> parsedUA.getValue(field)) .toMap + .view .filterKeys(validFields) + .toMap } /** Yauaa 7.x added many new fields which are not in the 1-0-4 schema */ diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala index 90126baeb..895138742 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/apirequest/ApiRequestEnrichment.scala @@ -93,7 +93,7 @@ object ApiRequestEnrichment extends ParseableEnrichment { UUID.nameUUIDFromBytes(contentKey.getBytes).toString } - def create[F[_]: Async: Clock]( + def create[F[_]: Async]( schemaKey: SchemaKey, inputs: List[Input], api: HttpApi, diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/pii/PiiPseudonymizerEnrichment.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/pii/PiiPseudonymizerEnrichment.scala index 955bf6ac7..c4f61995c 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/pii/PiiPseudonymizerEnrichment.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/pii/PiiPseudonymizerEnrichment.scala @@ -10,8 +10,8 @@ */ package com.snowplowanalytics.snowplow.enrich.common.enrichments.registry.pii -import scala.collection.JavaConverters._ -import scala.collection.mutable.MutableList +import scala.jdk.CollectionConverters._ +import scala.collection.mutable.ListBuffer import cats.data.ValidatedNel import cats.implicits._ @@ -216,7 +216,7 @@ final case class PiiJson( val jObjectMap = obj.toMap val contextMapped = jObjectMap.map(mapContextTopFields(_, strategy)) ( - Json.obj(contextMapped.mapValues(_._1).toList: _*), + Json.obj(contextMapped.view.mapValues(_._1).toList: _*), contextMapped.values.flatMap(_._2) ) } @@ -282,7 +282,7 @@ final case class PiiJson( ): (Json, List[JsonModifiedField]) = { val objectNode = io.circe.jackson.mapper.valueToTree[ObjectNode](json) val documentContext = JJsonPath.using(JsonPathConf).parse(objectNode) - val modifiedFields = MutableList[JsonModifiedField]() + val modifiedFields = ListBuffer[JsonModifiedField]() Option(documentContext.read[AnyRef](jsonPath)) match { // check that json object not null case None => (jacksonToCirce(documentContext.json[JsonNode]()), modifiedFields.toList) case _ => @@ -297,7 +297,7 @@ final case class PiiJson( private final case class ScrambleMapFunction( strategy: PiiStrategy, - modifiedFields: MutableList[JsonModifiedField], + modifiedFields: ListBuffer[JsonModifiedField], fieldName: String, jsonPath: String, schema: String diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/sqlquery/DbExecutor.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/sqlquery/DbExecutor.scala index 567c586f0..d9856e18b 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/sqlquery/DbExecutor.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/enrichments/registry/sqlquery/DbExecutor.scala @@ -193,6 +193,6 @@ object DbExecutor { if (intMap.keys.size == placeholderCount) true else false } - def getConnection[F[_]: Monad: DbExecutor](dataSource: DataSource): Resource[F, Connection] = + def getConnection[F[_]: DbExecutor](dataSource: DataSource): Resource[F, Connection] = DbExecutor[F].getConnection(dataSource) } diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/CollectorPayload.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/CollectorPayload.scala index 3ba901d9b..bd417e176 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/CollectorPayload.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/CollectorPayload.scala @@ -12,7 +12,7 @@ package com.snowplowanalytics.snowplow.enrich.common.loaders import java.util.UUID -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import cats.syntax.either._ import cats.syntax.option._ diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/Loader.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/Loader.scala index 8df5099d0..bc4391934 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/Loader.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/Loader.scala @@ -13,7 +13,7 @@ package com.snowplowanalytics.snowplow.enrich.common.loaders import java.net.URI import java.nio.charset.Charset -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import cats.data.ValidatedNel import cats.syntax.either._ diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/ThriftLoader.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/ThriftLoader.scala index 55e9099fd..e9de549bc 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/ThriftLoader.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/loaders/ThriftLoader.scala @@ -14,7 +14,7 @@ import java.nio.charset.Charset import java.time.Instant import java.util.UUID -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.control.NonFatal import cats.data.{NonEmptyList, ValidatedNel} diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/ConversionUtils.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/ConversionUtils.scala index 39866edcb..72ea8d1c6 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/ConversionUtils.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/ConversionUtils.scala @@ -19,7 +19,7 @@ import java.nio.charset.StandardCharsets.UTF_8 import java.util.UUID import java.io.{PrintWriter, StringWriter} -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.util.Try import scala.util.control.NonFatal @@ -182,7 +182,7 @@ object ConversionUtils { val validateInteger: (String, String) => Either[FailureDetails.EnrichmentFailure, String] = (field, str) => { Either - .catchNonFatal { str.toInt; str } + .catchNonFatal { str.toInt: Unit; str } .leftMap { _ => val f = FailureDetails.EnrichmentFailureMessage.InputData( field, diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/JsonPath.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/JsonPath.scala index 978dbd15c..923ab6150 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/JsonPath.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/JsonPath.scala @@ -18,7 +18,7 @@ import com.jayway.jsonpath.{Configuration, JsonPath => JaywayJsonPath, Option => import io.circe._ import io.circe.jackson.{circeToJackson, jacksonToCirce} -import scala.jdk.CollectionConverters.asScalaIteratorConverter +import scala.jdk.CollectionConverters._ /** Wrapper for `com.jayway.jsonpath` for circe */ object JsonPath { diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala index 6bc76be1c..00402b307 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala @@ -100,7 +100,7 @@ object MapTransformer { * @param obj Any Object * @return the new Transformable class, with manifest attached */ - implicit def makeTransformable[T <: AnyRef](obj: T)(implicit m: Manifest[T]) = + implicit def makeTransformable[T <: AnyRef](obj: T)(implicit m: Manifest[T]): TransformableClass[T] = new TransformableClass[T](obj) /** A pimped object, now transformable by using the transform method. */ @@ -166,6 +166,7 @@ object MapTransformer { setters(f3).invoke(obj, result._3) setters(f4).invoke(obj, result._4) 4.asRight // +4 to the count of fields successfully set + case other => throw new IllegalStateException(s"Illegal state: $other") } } case None => 0.asRight // Key not found: zero fields updated @@ -204,5 +205,7 @@ object MapTransformer { c.getDeclaredMethods .filter(_.getName.startsWith("set")) .groupBy(setterToFieldName(_)) + .view .mapValues(_.head) + .toMap } diff --git a/modules/common/src/main/scala/io/circe/jackson/enrich/CirceJsonDeserializer.scala b/modules/common/src/main/scala/io/circe/jackson/enrich/CirceJsonDeserializer.scala index d6824a3f2..d8854bcb4 100644 --- a/modules/common/src/main/scala/io/circe/jackson/enrich/CirceJsonDeserializer.scala +++ b/modules/common/src/main/scala/io/circe/jackson/enrich/CirceJsonDeserializer.scala @@ -19,7 +19,7 @@ import io.circe.jackson.{DeserializerContext, JacksonCompat, ReadingList, Readin import io.circe.{Json, JsonBigDecimal, JsonLong} import scala.annotation.{switch, tailrec} -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ private[jackson] final class CirceJsonDeserializer(klass: Class[_]) extends JsonDeserializer[Object] with JacksonCompat { override def isCachable: Boolean = true diff --git a/modules/kafka/src/it/scala/com/snowplowanalytics/snowplow/enrich/kafka/test/EnrichKafkaSpec.scala b/modules/kafka/src/it/scala/com/snowplowanalytics/snowplow/enrich/kafka/test/EnrichKafkaSpec.scala index ea30c37c6..11afcac2f 100644 --- a/modules/kafka/src/it/scala/com/snowplowanalytics/snowplow/enrich/kafka/test/EnrichKafkaSpec.scala +++ b/modules/kafka/src/it/scala/com/snowplowanalytics/snowplow/enrich/kafka/test/EnrichKafkaSpec.scala @@ -44,8 +44,8 @@ class EnrichKafkaSpec extends Specification with CatsEffect { val enrichedStream = "it-enrich-kinesis-enriched" val badRowsStream = "it-enrich-kinesis-bad" - val nbGood = 100l - val nbBad = 10l + val nbGood = 100L + val nbBad = 10L type AggregateGood = List[Event] type AggregateBad = List[String] @@ -55,12 +55,12 @@ class EnrichKafkaSpec extends Specification with CatsEffect { val bootstrapServers = s"localhost:$kafkaPort" val consumerConf: Map[String, String] = Map( - "group.id" -> "it-enrich", - "auto.offset.reset" -> "earliest", - "key.deserializer" -> "org.apache.kafka.common.serialization.StringDeserializer", - "value.deserializer" -> "org.apache.kafka.common.serialization.ByteArrayDeserializer", - "security.protocol" -> "PLAINTEXT", - "sasl.mechanism" -> "GSSAPI" + "group.id" -> "it-enrich", + "auto.offset.reset" -> "earliest", + "key.deserializer" -> "org.apache.kafka.common.serialization.StringDeserializer", + "value.deserializer" -> "org.apache.kafka.common.serialization.ByteArrayDeserializer", + "security.protocol" -> "PLAINTEXT", + "sasl.mechanism" -> "GSSAPI" ) val producerConf: Map[String, String] = Map( @@ -71,11 +71,13 @@ class EnrichKafkaSpec extends Specification with CatsEffect { def run(): IO[Aggregates] = { - val resources = Sink.init[IO](OutKafka(collectorPayloadsStream, bootstrapServers, "", Set.empty, producerConf), classOf[SourceAuthHandler].getName) + val resources = + Sink.init[IO](OutKafka(collectorPayloadsStream, bootstrapServers, "", Set.empty, producerConf), classOf[SourceAuthHandler].getName) resources.use { sink => val generate = - CollectorPayloadGen.generate[IO](nbGood, nbBad) + CollectorPayloadGen + .generate[IO](nbGood, nbBad) .evalMap(events => sink(List(events))) .onComplete(fs2.Stream.eval(Logger[IO].info(s"Random data has been generated and sent to $collectorPayloadsStream"))) @@ -83,10 +85,16 @@ class EnrichKafkaSpec extends Specification with CatsEffect { consumeGood(refGood).merge(consumeBad(refBad)) def consumeGood(ref: Ref[IO, AggregateGood]): Stream[IO, Unit] = - Source.init[IO](InKafka(enrichedStream, bootstrapServers, consumerConf), classOf[GoodSinkAuthHandler].getName).map(_.record.value).evalMap(aggregateGood(_, ref)) + Source + .init[IO](InKafka(enrichedStream, bootstrapServers, consumerConf), classOf[GoodSinkAuthHandler].getName) + .map(_.record.value) + .evalMap(aggregateGood(_, ref)) def consumeBad(ref: Ref[IO, AggregateBad]): Stream[IO, Unit] = - Source.init[IO](InKafka(badRowsStream, bootstrapServers, consumerConf), classOf[BadSinkAuthHandler].getName).map(_.record.value).evalMap(aggregateBad(_, ref)) + Source + .init[IO](InKafka(badRowsStream, bootstrapServers, consumerConf), classOf[BadSinkAuthHandler].getName) + .map(_.record.value) + .evalMap(aggregateBad(_, ref)) def aggregateGood(r: Array[Byte], ref: Ref[IO, AggregateGood]): IO[Unit] = for { @@ -94,12 +102,11 @@ class EnrichKafkaSpec extends Specification with CatsEffect { _ <- ref.update(updateAggregateGood(_, e)) } yield () - def aggregateBad(r: Array[Byte], ref: Ref[IO, AggregateBad]): IO[Unit] = { + def aggregateBad(r: Array[Byte], ref: Ref[IO, AggregateBad]): IO[Unit] = for { br <- IO(new String(r)) _ <- ref.update(updateAggregateBad(_, br)) } yield () - } def updateAggregateGood(aggregate: AggregateGood, e: Event): AggregateGood = e :: aggregate @@ -110,13 +117,12 @@ class EnrichKafkaSpec extends Specification with CatsEffect { for { refGood <- Ref.of[IO, AggregateGood](Nil) refBad <- Ref.of[IO, AggregateBad](Nil) - _ <- - generate - .merge(consume(refGood, refBad)) - .interruptAfter(30.seconds) - .attempt - .compile - .drain + _ <- generate + .merge(consume(refGood, refBad)) + .interruptAfter(30.seconds) + .attempt + .compile + .drain aggregateGood <- refGood.get aggregateBad <- refBad.get } yield Aggregates(aggregateGood, aggregateBad) diff --git a/modules/kafka/src/main/scala/com.snowplowanalytics.snowplow.enrich.kafka/Main.scala b/modules/kafka/src/main/scala/com.snowplowanalytics.snowplow.enrich.kafka/Main.scala index 0a9ef88e0..0d97dcb4f 100644 --- a/modules/kafka/src/main/scala/com.snowplowanalytics.snowplow.enrich.kafka/Main.scala +++ b/modules/kafka/src/main/scala/com.snowplowanalytics.snowplow.enrich.kafka/Main.scala @@ -74,6 +74,7 @@ object Main extends IOApp { else records .groupBy(_.record.partition) + .view .mapValues(_.maxBy(_.record.offset)) .values .toList diff --git a/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/DynamoDbConfig.scala b/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/DynamoDbConfig.scala index 35d9f6ca2..bd751b985 100644 --- a/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/DynamoDbConfig.scala +++ b/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/DynamoDbConfig.scala @@ -10,9 +10,8 @@ */ package com.snowplowanalytics.snowplow.enrich.kinesis -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.concurrent.duration.DurationLong -import scala.util.control.NonFatal import cats.effect.kernel.{Async, Resource, Sync} @@ -147,7 +146,7 @@ object DynamoDbConfig { private def worthRetrying[F[_]: Applicative](e: Throwable): F[Boolean] = e match { case ace: AmazonClientException if ace.isRetryable => Applicative[F].pure(true) - case NonFatal(_) => Applicative[F].pure(false) + case _ => Applicative[F].pure(false) } private def onError[F[_]: Sync](error: Throwable, details: RetryDetails): F[Unit] = diff --git a/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/Sink.scala b/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/Sink.scala index 6196250a1..14ed3034c 100644 --- a/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/Sink.scala +++ b/modules/kinesis/src/main/scala/com/snowplowanalytics/snowplow/enrich/kinesis/Sink.scala @@ -13,7 +13,7 @@ package com.snowplowanalytics.snowplow.enrich.kinesis import java.nio.ByteBuffer import java.util.UUID -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import cats.implicits._ import cats.{Monoid, Parallel} diff --git a/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Main.scala b/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Main.scala index 93fd912f9..85e9f68b9 100644 --- a/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Main.scala +++ b/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Main.scala @@ -16,7 +16,7 @@ import cats.Parallel import cats.implicits._ import cats.effect.{ExitCode, IO, IOApp} -import cats.effect.kernel.{Resource, Sync} +import cats.effect.kernel.Resource import cats.effect.metrics.CpuStarvationWarningMetrics import org.typelevel.log4cats.Logger @@ -66,7 +66,7 @@ object Main extends IOApp { None ) - private def checkpoint[F[_]: Parallel: Sync](records: List[Record[F]]): F[Unit] = + private def checkpoint[F[_]: Parallel](records: List[Record[F]]): F[Unit] = records.parTraverse_(_.ack) private def createBlobStorageClient(conf: BlobStorageClients): List[Resource[IO, Client[IO]]] = { diff --git a/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Sink.scala b/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Sink.scala index 7016a2b76..ba8c66a1e 100644 --- a/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Sink.scala +++ b/modules/nsq/src/main/scala/com/snowplowanalytics/snowplow/enrich/nsq/Sink.scala @@ -10,7 +10,7 @@ */ package com.snowplowanalytics.snowplow.enrich.nsq -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import cats.effect.kernel.{Async, Resource, Sync} diff --git a/modules/pubsub/src/main/scala/com/snowplowanalytics/snowplow/enrich/pubsub/Main.scala b/modules/pubsub/src/main/scala/com/snowplowanalytics/snowplow/enrich/pubsub/Main.scala index daee27114..033023d05 100644 --- a/modules/pubsub/src/main/scala/com/snowplowanalytics/snowplow/enrich/pubsub/Main.scala +++ b/modules/pubsub/src/main/scala/com/snowplowanalytics/snowplow/enrich/pubsub/Main.scala @@ -15,7 +15,7 @@ import scala.concurrent.duration._ import cats.Parallel import cats.implicits._ -import cats.effect.kernel.{Resource, Sync} +import cats.effect.kernel.Resource import cats.effect.{ExitCode, IO, IOApp} import cats.effect.metrics.CpuStarvationWarningMetrics @@ -68,6 +68,6 @@ object Main extends IOApp { None ) - private def checkpoint[F[_]: Parallel: Sync](records: List[ConsumerRecord[F, Array[Byte]]]): F[Unit] = + private def checkpoint[F[_]: Parallel](records: List[ConsumerRecord[F, Array[Byte]]]): F[Unit] = records.parTraverse_(_.ack) } diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index 1d7aabf3c..2559020e1 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -20,7 +20,6 @@ import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport._ import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport._ import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport._ import org.scalafmt.sbt.ScalafmtPlugin.autoImport._ -import scoverage.ScoverageKeys._ object BuildSettings { @@ -159,14 +158,6 @@ object BuildSettings { // TESTS - lazy val scoverageSettings = Seq( - coverageMinimumStmtTotal := 50, - coverageFailOnMinimum := false, - (Test / test) := { - (coverageReport dependsOn (Test / test)).value - } - ) - lazy val noParallelTestExecution = Seq(Test / parallelExecution := false) /** Add example config for integration tests. */ @@ -187,35 +178,35 @@ object BuildSettings { // Build and publish publishSettings ++ // Tests - scoverageSettings ++ noParallelTestExecution + noParallelTestExecution } lazy val commonFs2BuildSettings = { // Project commonFs2ProjectSettings ++ buildSettings ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ addExampleConfToTestCp + noParallelTestExecution ++ addExampleConfToTestCp } lazy val awsUtilsBuildSettings = { // Project awsUtilsProjectSettings ++ buildSettings ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ addExampleConfToTestCp + noParallelTestExecution ++ addExampleConfToTestCp } lazy val gcpUtilsBuildSettings = { // Project gcpUtilsProjectSettings ++ buildSettings ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ addExampleConfToTestCp + noParallelTestExecution ++ addExampleConfToTestCp } lazy val azureUtilsBuildSettings = { // Project azureUtilsProjectSettings ++ buildSettings ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ addExampleConfToTestCp + noParallelTestExecution ++ addExampleConfToTestCp } lazy val pubsubBuildSettings = { @@ -225,7 +216,7 @@ object BuildSettings { dockerSettingsFocal ++ Seq(Docker / packageName := "snowplow-enrich-pubsub") ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ addExampleConfToTestCp + noParallelTestExecution ++ addExampleConfToTestCp } lazy val pubsubDistrolessBuildSettings = pubsubBuildSettings.diff(dockerSettingsFocal) ++ dockerSettingsDistroless @@ -237,7 +228,7 @@ object BuildSettings { dockerSettingsFocal ++ Seq(Docker / packageName := "snowplow-enrich-kinesis") ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ Seq(Test / fork := true) ++ addExampleConfToTestCp + noParallelTestExecution ++ Seq(Test / fork := true) ++ addExampleConfToTestCp } lazy val kinesisDistrolessBuildSettings = kinesisBuildSettings.diff(dockerSettingsFocal) ++ dockerSettingsDistroless @@ -249,7 +240,7 @@ object BuildSettings { dockerSettingsFocal ++ Seq(Docker / packageName := "snowplow-enrich-kafka") ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ addExampleConfToTestCp + noParallelTestExecution ++ addExampleConfToTestCp } lazy val kafkaDistrolessBuildSettings = kafkaBuildSettings.diff(dockerSettingsFocal) ++ dockerSettingsDistroless @@ -261,7 +252,7 @@ object BuildSettings { dockerSettingsFocal ++ Seq(Docker / packageName := "snowplow-enrich-nsq") ++ // Tests - scoverageSettings ++ noParallelTestExecution ++ addExampleConfToTestCp + noParallelTestExecution ++ addExampleConfToTestCp } lazy val nsqDistrolessBuildSettings = nsqBuildSettings.diff(dockerSettingsFocal) ++ dockerSettingsDistroless diff --git a/project/plugins.sbt b/project/plugins.sbt index 5ed1caaa7..ccee45e47 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,5 @@ -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2") -addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17") -addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.1") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.2") -addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") -addSbtPlugin("com.snowplowanalytics" % "sbt-snowplow-release" % "0.3.1") +addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.2") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") +addSbtPlugin("com.snowplowanalytics" % "sbt-snowplow-release" % "0.3.1") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") +addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") \ No newline at end of file