Skip to content

Commit

Permalink
Use derevo-circe-magnolia + configure scalafix for it:tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gvolpe committed Feb 22, 2021
1 parent bf2b8cc commit 9021fa9
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 36 deletions.
9 changes: 6 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ ThisBuild / organization := "dev.profunktor"
ThisBuild / organizationName := "ProfunKtor"

ThisBuild / scalafixDependencies += Libraries.organizeImports
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision

resolvers += Resolver.sonatypeRepo("snapshots")

val scalafixCommonSettings = inConfig(IntegrationTest)(scalafixConfigSettings(IntegrationTest))

lazy val root = (project in file("."))
.settings(
name := "shopping-cart"
Expand All @@ -20,11 +24,9 @@ lazy val tests = (project in file("modules/tests"))
.settings(
name := "shopping-cart-test-suite",
scalacOptions ++= List("-Ymacro-annotations", "-Yrangepos", "-Wconf:cat=unused:info"),
scalafmtOnCompile := true,
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
testFrameworks += new TestFramework("munit.Framework"),
Defaults.itSettings,
scalafixCommonSettings,
libraryDependencies ++= Seq(
CompilerPlugin.kindProjector,
CompilerPlugin.betterMonadicFor,
Expand All @@ -45,6 +47,7 @@ lazy val core = (project in file("modules/core"))
scalafmtOnCompile := true,
resolvers += Resolver.sonatypeRepo("snapshots"),
Defaults.itSettings,
scalafixCommonSettings,
dockerBaseImage := "openjdk:8u201-jre-alpine3.9",
dockerExposedPorts ++= Seq(8080),
makeBatScripts := Seq(),
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/auth.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import javax.crypto.Cipher
import scala.util.control.NoStackTrace

import derevo.cats.{ eq => eqv }
import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import eu.timepit.refined.types.string.NonEmptyString
import io.circe._
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/brand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import java.util.UUID
import scala.util.control.NoStackTrace

import derevo.cats.{ eq => eqv }
import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import eu.timepit.refined.types.string.NonEmptyString
import io.circe.Decoder
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/cart.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scala.util.control.NoStackTrace
import shop.domain.auth.UserId

import derevo.cats.{ eq => eqv }
import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import io.circe.{ Decoder, Encoder }
import io.estatico.newtype.macros.newtype
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/category.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package shop.domain
import java.util.UUID

import derevo.cats.{ eq => eqv }
import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import eu.timepit.refined.types.string.NonEmptyString
import io.circe.Decoder
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/checkout.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package shop.domain

import shop.ext.refined._

import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import eu.timepit.refined._
import eu.timepit.refined.api._
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/healthcheck.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package shop.domain

import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import io.estatico.newtype.macros._

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/item.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import shop.domain.brand._
import shop.domain.category._

import derevo.cats.{ eq => eqv }
import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import eu.timepit.refined.api.Refined
import eu.timepit.refined.string.{ Uuid, ValidBigDecimal }
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/order.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import shop.domain.cart._
import shop.domain.item._

import derevo.cats.{ eq => eqv }
import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import io.circe.Decoder
import io.estatico.newtype.macros.newtype
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/domain/payment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package shop.domain
import shop.domain.auth.UserId
import shop.domain.checkout.Card

import derevo.circe.encoder
import derevo.circe.magnolia.encoder
import derevo.derive
import squants.market.Money

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/shop/http/auth/users.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package shop.http.auth

import shop.domain.auth._

import derevo.circe.{ decoder, encoder }
import derevo.circe.magnolia.{ decoder, encoder }
import derevo.derive
import dev.profunktor.auth.jwt._
import io.estatico.newtype.macros.newtype
Expand Down
19 changes: 10 additions & 9 deletions modules/tests/src/it/scala/shop/algebras/PostgresTest.scala
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
package shop.algebras

import shop.arbitraries._
import shop.config.data.PasswordSalt
import shop.domain.auth._
import shop.domain.brand._
import shop.domain.cart._
import shop.domain.category._
import shop.domain.item._
import shop.domain.order._

import cats.effect._
import cats.implicits._
import ciris._
import eu.timepit.refined.auto._
import eu.timepit.refined.cats._
import eu.timepit.refined.types.string.NonEmptyString
import io.estatico.newtype.ops._
import natchez.Trace.Implicits.noop // needed for skunk
import natchez.Trace.Implicits.noop
import org.scalacheck.Prop._
import shop.arbitraries._
import shop.config.data.PasswordSalt
import shop.domain.auth._
import shop.domain.brand._
import shop.domain.category._
import shop.domain.cart._
import shop.domain.item._
import shop.domain.order._
import skunk._
import squants.market.Money
import suite._
Expand Down
28 changes: 15 additions & 13 deletions modules/tests/src/it/scala/shop/algebras/RedisTest.scala
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
package shop.algebras

import java.util.UUID

import scala.concurrent.duration._

import shop.arbitraries._
import shop.config.data._
import shop.domain.auth._
import shop.domain.brand._
import shop.domain.cart._
import shop.domain.category._
import shop.domain.item._
import shop.http.auth.users._
import shop.logger.NoOp

import cats.Eq
import cats.effect._
import cats.effect.concurrent.Ref
import cats.implicits._
import ciris.Secret
import dev.profunktor.auth.jwt._
import dev.profunktor.redis4cats.{ Redis, RedisCommands }
import dev.profunktor.redis4cats.log4cats._
import dev.profunktor.redis4cats.{ Redis, RedisCommands }
import eu.timepit.refined.auto._
import eu.timepit.refined.cats._
import eu.timepit.refined.types.string.NonEmptyString
import java.util.UUID
import org.scalacheck.Prop._
import pdi.jwt._
import scala.concurrent.duration._
import shop.arbitraries._
import shop.config.data._
import shop.domain._
import shop.domain.auth._
import shop.domain.brand._
import shop.domain.category._
import shop.domain.cart._
import shop.domain.item._
import shop.logger.NoOp
import shop.http.auth.users._
import suite._

class RedisTest extends ResourceSuite[RedisCommands[IO, String, String]] {
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object Dependencies {

val derevoCore = derevo("core")
val derevoCats = derevo("cats")
val derevoCirce = derevo("circe")
val derevoCirce = derevo("circe-magnolia")

val http4sDsl = http4s("dsl")
val http4sServer = http4s("ember-server")
Expand Down

0 comments on commit 9021fa9

Please sign in to comment.