From 31ebc54e766f376d1f6a22c787f147ec2f7b5a94 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Thu, 13 Jun 2024 12:44:17 +0200 Subject: [PATCH 1/7] Upgrade most dependencies --- .github/workflows/ci.yml | 290 ++++++++++++++++++++++++++++++--------- build.sbt | 15 +- project/build.properties | 2 +- project/plugins.sbt | 13 +- 4 files changed, 238 insertions(+), 82 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1f40998..c35ddcfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,84 +15,73 @@ on: tags: [v*] env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }} @ ${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build and Test strategy: matrix: os: [ubuntu-latest] - scala: [2.12.18, 2.13.7] + scala: [2.12, 2.13] java: [temurin@8, temurin@17] project: [rootJS, rootJVM, rootNative] exclude: + - scala: 2.12 + java: temurin@17 - project: rootJS java: temurin@17 - project: rootNative java: temurin@17 runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Download Java (temurin@8) - id: download-java-temurin-8 - if: matrix.java == 'temurin@8' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 8 - - name: Setup Java (temurin@8) + id: setup-java-temurin-8 if: matrix.java == 'temurin@8' - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: - distribution: jdkfile + distribution: temurin java-version: 8 - jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }} + cache: sbt - - name: Download Java (temurin@17) - id: download-java-temurin-17 - if: matrix.java == 'temurin@17' - uses: typelevel/download-java@v2 - with: - distribution: temurin - java-version: 17 + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update - name: Setup Java (temurin@17) + id: setup-java-temurin-17 if: matrix.java == 'temurin@17' - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: - distribution: jdkfile + distribution: temurin java-version: 17 - jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} + cache: sbt - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update - name: Check that workflows are up to date run: sbt githubWorkflowCheck - - name: Check formatting + - name: Check headers and formatting if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' - run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck + + - name: Check scalafix lints + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'scalafixAll --check' - name: scalaJSLink if: matrix.project == 'rootJS' @@ -113,45 +102,216 @@ jobs: if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - coverage: - name: Generate coverage report + - name: Make target directories + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') + run: mkdir -p generic-extras/.js/target generic-extras/.jvm/target generic-extras/.native/target project/target + + - name: Compress target directories + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') + run: tar cf targets.tar generic-extras/.js/target generic-extras/.jvm/target generic-extras/.native/target project/target + + - name: Upload target directories + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') + uses: actions/upload-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} + path: targets.tar + + publish: + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') strategy: matrix: os: [ubuntu-latest] - scala: [2.13.7] - java: [temurin@11] + java: [temurin@8] runs-on: ${{ matrix.os }} steps: - - name: Checkout current branch (fast) - uses: actions/checkout@v3 + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java (temurin@8) + id: setup-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update - - name: Download Java (temurin@17) - id: download-java-temurin-17 + - name: Setup Java (temurin@17) + id: setup-java-temurin-17 if: matrix.java == 'temurin@17' - uses: typelevel/download-java@v2 + uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update + + - name: Download target directories (2.12, rootJS) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJS + + - name: Inflate target directories (2.12, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.12, rootJVM) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJVM + + - name: Inflate target directories (2.12, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.12, rootNative) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootNative + + - name: Inflate target directories (2.12, rootNative) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13, rootJS) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS + + - name: Inflate target directories (2.13, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13, rootJVM) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM + + - name: Inflate target directories (2.13, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13, rootNative) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative + + - name: Inflate target directories (2.13, rootNative) + run: | + tar xf targets.tar + rm targets.tar + + - name: Import signing key + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: echo $PGP_SECRET | base64 -d -i - | gpg --import + + - name: Import signing key and strip passphrase + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: | + echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg + echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg + (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) + + - name: Publish + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} + run: sbt tlCiRelease + + dependency-submission: + name: Submit Dependencies + if: github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java (temurin@8) + id: setup-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update - name: Setup Java (temurin@17) + id: setup-java-temurin-17 if: matrix.java == 'temurin@17' - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: - distribution: jdkfile + distribution: temurin java-version: 17 - jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }} - - - name: Cache sbt - uses: actions/cache@v3 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update + + - name: Submit Dependencies + uses: scalacenter/sbt-dependency-submission@v2 + with: + modules-ignore: circe-generic-extras-benchmarks_2.12 circe-generic-extras-benchmarks_2.13 rootjs_2.12 rootjs_2.13 rootjvm_2.12 rootjvm_2.13 rootnative_2.12 rootnative_2.13 + configs-ignore: test scala-tool scala-doc-tool test-internal + + coverage: + name: Generate coverage report + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.13.14] + java: [temurin@11] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (fast) + uses: actions/checkout@v4 + + - name: Setup Java (temurin@17) + id: setup-java-temurin-17 + if: matrix.java == 'temurin@17' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update - run: sbt '++ ${{ matrix.scala }}' coverage rootJVM/test coverageAggregate diff --git a/build.sbt b/build.sbt index fda582f3..6ca9a852 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,9 @@ import sbtcrossproject.{ CrossType, crossProject } -val Scala212V = "2.12.18" -val Scala213V = "2.13.7" +val Scala212V = "2.12.19" +val Scala213V = "2.13.14" -val circeVersion = "0.14.6" +val circeVersion = "0.14.7" val paradiseVersion = "2.1.1" val jawnVersion = "1.5.1" @@ -44,7 +44,7 @@ ThisBuild / githubWorkflowAddedJobs ++= Seq( ) ) -val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs") +//val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs") lazy val root = tlCrossRootProject.aggregate(genericExtras, benchmarks) @@ -72,8 +72,8 @@ lazy val genericExtras = crossProject(JSPlatform, JVMPlatform, NativePlatform) } else Nil ), testFrameworks := List(new TestFramework("munit.Framework")), // Override setting so Scalatest is disabled - docMappingsApiDir := "api", - addMappingsToSiteDir(Compile / packageDoc / mappings, docMappingsApiDir), + //docMappingsApiDir := "api", + //addMappingsToSiteDir(Compile / packageDoc / mappings, docMappingsApiDir), scalacOptions ++= { if (scalaBinaryVersion.value == "2.13") Seq("-Ymacro-annotations") else Seq.empty }, @@ -107,5 +107,6 @@ ThisBuild / licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/ ThisBuild / developers := List( Developer("travisbrown", "Travis Brown", "travisrobertbrown@gmail.com", url("https://twitter.com/travisbrown")), Developer("zmccoy", "Zach McCoy", "zachabbott@gmail.com", url("https://twitter.com/zachamccoy")), - Developer("zarthross", "Darren Gibson", "zarthross@gmail.com", url("https://twitter.com/zarthross")) + Developer("zarthross", "Darren Gibson", "zarthross@gmail.com", url("https://twitter.com/zarthross")), + Developer("hamnis", "Erlend Hamnaberg", "erlend@hamnaberg.net", url("https://github.com/hamnis")) ) diff --git a/project/build.properties b/project/build.properties index e8a1e246..081fdbbc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.7 +sbt.version=1.10.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index d85d1519..010ce086 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,10 +1,5 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") -addSbtPlugin("org.typelevel" % "sbt-typelevel-ci-release" % "0.4.22") -addSbtPlugin("org.typelevel" % "sbt-typelevel-settings" % "0.4.22") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0") -addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") -addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") +addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7") +addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.1") From 37f7c69d24206a0a0e34d387ab437394b9c6365c Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Thu, 13 Jun 2024 13:16:25 +0200 Subject: [PATCH 2/7] Fix compile warnings formatting --- build.sbt | 4 ++-- .../io/circe/generic/extras/AutoDerivation.scala | 1 - .../circe/generic/extras/ConfiguredJsonCodec.scala | 4 +++- .../generic/extras/codec/EnumerationCodec.scala | 4 ++-- .../generic/extras/codec/ReprAsObjectCodec.scala | 1 - .../generic/extras/decoding/EnumerationDecoder.scala | 2 +- .../circe/generic/extras/decoding/ReprDecoder.scala | 5 ++--- .../generic/extras/encoding/EnumerationEncoder.scala | 7 ++++--- .../extras/encoding/ReprAsObjectEncoder.scala | 2 +- .../scala/io/circe/generic/extras/CirceSuite.scala | 4 +--- .../generic/extras/ConfiguredJsonCodecSuite.scala | 2 -- .../extras/EnumerationSemiautoDerivedSuite.scala | 12 ++++++++---- .../extras/UnwrappedSemiautoDerivedSuite.scala | 2 +- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/build.sbt b/build.sbt index 6ca9a852..0e0bbc97 100644 --- a/build.sbt +++ b/build.sbt @@ -72,8 +72,8 @@ lazy val genericExtras = crossProject(JSPlatform, JVMPlatform, NativePlatform) } else Nil ), testFrameworks := List(new TestFramework("munit.Framework")), // Override setting so Scalatest is disabled - //docMappingsApiDir := "api", - //addMappingsToSiteDir(Compile / packageDoc / mappings, docMappingsApiDir), + // docMappingsApiDir := "api", + // addMappingsToSiteDir(Compile / packageDoc / mappings, docMappingsApiDir), scalacOptions ++= { if (scalaBinaryVersion.value == "2.13") Seq("-Ymacro-annotations") else Seq.empty }, diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala b/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala index fb6b7dca..b45cbc0b 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala @@ -5,7 +5,6 @@ import io.circe.export.Exported import io.circe.generic.extras.decoding.ConfiguredDecoder import io.circe.generic.extras.encoding.ConfiguredAsObjectEncoder import io.circe.generic.util.macros.ExportMacros -import scala.language.experimental.macros /** * Fully automatic configurable codec derivation. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala index b99d4925..0fcec684 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala @@ -1,9 +1,11 @@ package io.circe.generic.extras import io.circe.generic.util.macros.JsonCodecMacros -import scala.language.experimental.macros + +import scala.annotation.nowarn import scala.reflect.macros.blackbox +@nowarn("cat=unused") class ConfiguredJsonCodec( encodeOnly: Boolean = false, decodeOnly: Boolean = false diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala index 0b83f3eb..c3cfabbb 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala @@ -36,10 +36,10 @@ object EnumerationCodec { case Right(v) => Right(Inr(v)) case Left(err) => Left(err) } - case Left(err) => Left(DecodingFailure("Enumeration", c.history)) + case Left(_) => Left(DecodingFailure("Enumeration", c.history)) } def apply(a: FieldType[K, V] :+: R): Json = a match { - case Inl(l) => Json.fromString(config.transformConstructorNames(witK.value.name)) + case Inl(_) => Json.fromString(config.transformConstructorNames(witK.value.name)) case Inr(r) => codecForR(r) } } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala index 4098338f..29fe7b0e 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala @@ -7,7 +7,6 @@ import io.circe.generic.extras.decoding.ReprDecoder import io.circe.generic.extras.encoding.ReprAsObjectEncoder import scala.annotation.implicitNotFound import scala.collection.immutable.Map -import scala.language.experimental.macros import shapeless.HNil /** diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala index 84a1ace4..f9586238 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala @@ -35,7 +35,7 @@ object EnumerationDecoder { case Right(v) => Right(Inr(v)) case Left(err) => Left(err) } - case Left(err) => Left(DecodingFailure("Enumeration", c.history)) + case Left(_) => Left(DecodingFailure("Enumeration", c.history)) } } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala index 08b85bfa..888d27ca 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala @@ -6,7 +6,6 @@ import io.circe.Json.JNull import io.circe.generic.extras.ConfigurableDeriver import scala.annotation.implicitNotFound import scala.collection.immutable.Map -import scala.language.experimental.macros import shapeless.HNil /** @@ -51,7 +50,7 @@ abstract class ReprDecoder[A] extends Decoder[A] { case (true, Some(d: B @unchecked)) => Right(d) case (_, Some(d: B @unchecked)) => decoder.tryDecode(c) match { - case l @ Left(_) if c.focus.contains(JNull) => + case Left(_) if c.focus.contains(JNull) => Right(d) case otherwise => otherwise @@ -70,7 +69,7 @@ abstract class ReprDecoder[A] extends Decoder[A] { case (true, Some(d: B @unchecked)) => Validated.valid(d) case (_, Some(d: B @unchecked)) => decoder.tryDecodeAccumulating(c) match { - case l @ Validated.Invalid(_) if c.focus.contains(JNull) => + case Validated.Invalid(_) if c.focus.contains(JNull) => Validated.valid(d) case otherwise => otherwise diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala index 615a7c33..a0b62981 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala @@ -2,7 +2,8 @@ package io.circe.generic.extras.encoding import io.circe.{ Encoder, Json } import io.circe.generic.extras.Configuration -import scala.annotation.implicitNotFound + +import scala.annotation.{ implicitNotFound, nowarn } import shapeless.{ :+:, CNil, Coproduct, HNil, Inl, Inr, LabelledGeneric, Witness } import shapeless.labelled.FieldType @@ -22,12 +23,12 @@ object EnumerationEncoder { implicit def encodeEnumerationCCons[K <: Symbol, V, R <: Coproduct](implicit witK: Witness.Aux[K], - gen: LabelledGeneric.Aux[V, HNil], + @nowarn gen: LabelledGeneric.Aux[V, HNil], encodeR: EnumerationEncoder[R], config: Configuration = Configuration.default ): EnumerationEncoder[FieldType[K, V] :+: R] = new EnumerationEncoder[FieldType[K, V] :+: R] { def apply(a: FieldType[K, V] :+: R): Json = a match { - case Inl(l) => Json.fromString(config.transformConstructorNames(witK.value.name)) + case Inl(_) => Json.fromString(config.transformConstructorNames(witK.value.name)) case Inr(r) => encodeR(r) } } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala index cb601a7f..37426c6e 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala @@ -1,8 +1,8 @@ package io.circe.generic.extras.encoding + import io.circe.{ Encoder, Json, JsonObject } import io.circe.generic.extras.ConfigurableDeriver import scala.annotation.implicitNotFound -import scala.language.experimental.macros /** * An encoder for a generic representation of a case class or ADT. diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala index 2872b95b..64c644f8 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala @@ -3,10 +3,8 @@ package io.circe.generic.extras import cats.instances._ import cats.syntax._ import io.circe.testing.{ ArbitraryInstances, EqInstances } -import org.typelevel.discipline.Laws -import scala.language.implicitConversions -import munit.{ DisciplineSuite, Location, ScalaCheckSuite } +import munit.DisciplineSuite /** * An opinionated stack of traits to improve consistency and reduce boilerplate in circe tests. diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala index a8092741..cef8fc44 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala @@ -7,8 +7,6 @@ import io.circe.testing.CodecTests import org.scalacheck.Prop.forAll import org.scalacheck.{ Arbitrary, Gen } -import scala.Console.in - object ConfiguredJsonCodecSuite { implicit val customConfig: Configuration = Configuration.default.withSnakeCaseMemberNames.withDefaults.withDiscriminator("type").withSnakeCaseConstructorNames diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala index aff5773c..22336fde 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala @@ -29,11 +29,13 @@ class EnumerationSemiautoDerivedSuite extends CirceSuite { test("deriveEnumerationDecoder should not compile on an ADT with case classes") { implicit val config: Configuration = Configuration.default + val _ = config illTyped("deriveEnumerationDecoder[ExtendedCardinalDirection]") } - test("it should respect Configuration") { + test("it should respect Configuration snake-case") { implicit val config: Configuration = Configuration.default.withSnakeCaseConstructorNames + val _ = config val decodeMary = deriveEnumerationDecoder[Mary] val expected = json""""little_lamb"""" assert(decodeMary.decodeJson(expected) === Right(LittleLamb)) @@ -41,13 +43,15 @@ class EnumerationSemiautoDerivedSuite extends CirceSuite { test("deriveEnumerationEncoder should not compile on an ADT with case classes") { implicit val config: Configuration = Configuration.default + val _ = config illTyped("deriveEnumerationEncoder[ExtendedCardinalDirection]") } - test("it should respect Configuration") { - implicit val config: Configuration = Configuration.default.withSnakeCaseConstructorNames + test("it should respect Configuration kebab-case") { + implicit val config: Configuration = Configuration.default.withKebabCaseConstructorNames + val _ = config val encodeMary = deriveEnumerationEncoder[Mary] - val expected = json""""little_lamb"""" + val expected = json""""little-lamb"""" assert(encodeMary(LittleLamb) === expected) } } diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala index 9898d312..d3df583a 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala @@ -49,7 +49,7 @@ class UnwrappedSemiautoDerivedSuite extends CirceSuite { } property("it should fail decoding incompatible JSON") { - forAll { (i: Int, s: String) => + forAll { (i: Int) => val json = Json.fromInt(i) val expected = Left(DecodingFailure(DecodingFailure.Reason.WrongTypeExpectation("string", json), List())) From 50841c955e6d84e548a915a22859e3babc5d89d4 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Thu, 13 Jun 2024 13:24:29 +0200 Subject: [PATCH 3/7] Add licenses headers --- .../benchmarks/RetryDecoderWithDefault.scala | 16 ++++++++++++++++ build.sbt | 2 +- .../io/circe/generic/extras/AutoDerivation.scala | 16 ++++++++++++++++ .../generic/extras/ConfigurableDeriver.scala | 16 ++++++++++++++++ .../io/circe/generic/extras/Configuration.scala | 16 ++++++++++++++++ .../generic/extras/ConfiguredJsonCodec.scala | 16 ++++++++++++++++ .../io/circe/generic/extras/ExtrasDecoder.scala | 16 ++++++++++++++++ .../scala/io/circe/generic/extras/JsonKey.scala | 16 ++++++++++++++++ .../io/circe/generic/extras/auto/package.scala | 16 ++++++++++++++++ .../extras/codec/ConfiguredAsObjectCodec.scala | 16 ++++++++++++++++ .../generic/extras/codec/EnumerationCodec.scala | 16 ++++++++++++++++ .../generic/extras/codec/ReprAsObjectCodec.scala | 16 ++++++++++++++++ .../generic/extras/codec/UnwrappedCodec.scala | 16 ++++++++++++++++ .../extras/decoding/ConfiguredDecoder.scala | 16 ++++++++++++++++ .../extras/decoding/EnumerationDecoder.scala | 16 ++++++++++++++++ .../decoding/IncompleteConfiguredDecoders.scala | 16 ++++++++++++++++ .../generic/extras/decoding/ReprDecoder.scala | 16 ++++++++++++++++ .../extras/decoding/UnwrappedDecoder.scala | 16 ++++++++++++++++ .../encoding/ConfiguredAsObjectEncoder.scala | 16 ++++++++++++++++ .../extras/encoding/EnumerationEncoder.scala | 16 ++++++++++++++++ .../extras/encoding/ReprAsObjectEncoder.scala | 16 ++++++++++++++++ .../extras/encoding/UnwrappedEncoder.scala | 16 ++++++++++++++++ .../circe/generic/extras/encoding/package.scala | 16 ++++++++++++++++ .../scala/io/circe/generic/extras/package.scala | 16 ++++++++++++++++ .../scala/io/circe/generic/extras/semiauto.scala | 16 ++++++++++++++++ .../circe/generic/extras/util/RecordToMap.scala | 16 ++++++++++++++++ .../io/circe/generic/extras/CirceSuite.scala | 16 ++++++++++++++++ .../extras/ConfiguredAutoDerivedSuite.scala | 16 ++++++++++++++++ .../extras/ConfiguredJsonCodecSuite.scala | 16 ++++++++++++++++ .../extras/ConfiguredJsonCodecWithKeySuite.scala | 16 ++++++++++++++++ .../extras/ConfiguredSemiautoDerivedSuite.scala | 16 ++++++++++++++++ .../extras/EnumerationSemiautoDerivedSuite.scala | 16 ++++++++++++++++ .../extras/UnwrappedSemiautoDerivedSuite.scala | 16 ++++++++++++++++ .../extras/examples/CardinalDirection.scala | 16 ++++++++++++++++ .../circe/generic/extras/examples/package.scala | 16 ++++++++++++++++ 35 files changed, 545 insertions(+), 1 deletion(-) diff --git a/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala b/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala index b137ba84..1e86f9e5 100644 --- a/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala +++ b/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe package generic.extras package benchmarks diff --git a/build.sbt b/build.sbt index 0e0bbc97..894f7185 100644 --- a/build.sbt +++ b/build.sbt @@ -103,7 +103,7 @@ lazy val benchmarks = project .dependsOn(genericExtras.jvm) .enablePlugins(JmhPlugin, NoPublishPlugin) -ThisBuild / licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) +ThisBuild / startYear := Some(2019) ThisBuild / developers := List( Developer("travisbrown", "Travis Brown", "travisrobertbrown@gmail.com", url("https://twitter.com/travisbrown")), Developer("zmccoy", "Zach McCoy", "zachabbott@gmail.com", url("https://twitter.com/zachamccoy")), diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala b/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala index b45cbc0b..1ee1d177 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import io.circe.{ Decoder, Encoder } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala b/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala index cb02fb51..35754de2 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import io.circe.generic.extras.codec.{ ConfiguredAsObjectCodec, ReprAsObjectCodec } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/Configuration.scala b/generic-extras/src/main/scala/io/circe/generic/extras/Configuration.scala index 0b1e66ba..45d42e04 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/Configuration.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/Configuration.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import java.util.regex.Pattern diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala index 0fcec684..c83d2a98 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/ConfiguredJsonCodec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import io.circe.generic.util.macros.JsonCodecMacros diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala index 5e7297ba..19fa22ae 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import io.circe.{ Decoder, DecodingFailure, HCursor } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/JsonKey.scala b/generic-extras/src/main/scala/io/circe/generic/extras/JsonKey.scala index 79bf0429..8be740fa 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/JsonKey.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/JsonKey.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import scala.annotation.StaticAnnotation diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/auto/package.scala b/generic-extras/src/main/scala/io/circe/generic/extras/auto/package.scala index 08c9a480..ca72f2f9 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/auto/package.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/auto/package.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras /** diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala index 3b5d9164..51adee01 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.codec import io.circe.{ Decoder, Encoder, HCursor, JsonObject } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala index c3cfabbb..c7c20970 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.codec import io.circe.{ Codec, Decoder, DecodingFailure, HCursor, Json } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala index 29fe7b0e..c1a1cfd5 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.codec import cats.data.Validated diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala index afe2c103..4140df4b 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.codec import io.circe.{ Codec, Decoder, Encoder, HCursor, Json } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala index 7f6b3ab9..25055789 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.decoding import io.circe.{ Decoder, DecodingFailure, HCursor } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala index f9586238..47b5315a 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.decoding import io.circe.{ Decoder, DecodingFailure, HCursor } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala index 74fc618e..2c8f4bd8 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.decoding import io.circe.{ Decoder, HCursor } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala index 888d27ca..8365f34c 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.decoding import cats.data.Validated diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala index e157657e..8c1c2c5c 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.decoding import io.circe.{ Decoder, HCursor } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala index 6a79cf38..80918cb1 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.encoding import io.circe.JsonObject diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala index a0b62981..169432e7 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.encoding import io.circe.{ Encoder, Json } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala index 37426c6e..0833c16e 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.encoding import io.circe.{ Encoder, Json, JsonObject } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala index dea9548f..3c6147a0 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.encoding import io.circe.{ Encoder, Json } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/package.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/package.scala index f6569eb9..5bbc73f1 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/package.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/package.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras package object encoding { diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/package.scala b/generic-extras/src/main/scala/io/circe/generic/extras/package.scala index b22865da..010a0b33 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/package.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/package.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic import io.circe.Codec diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala b/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala index 95c4012b..6e56c284 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import io.circe.{ Codec, Decoder, Encoder } diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala b/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala index 20bd6228..39183a5e 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.util import scala.collection.immutable.Map diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala index 64c644f8..588aa833 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import cats.instances._ diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala index e767051a..7f845e27 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import cats.data.Validated diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala index cef8fc44..bb9763b9 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import cats.kernel.Eq diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala index abc1d811..fde26a0b 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import cats.kernel.Eq diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala index a49f7f44..25c10658 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import cats.kernel.Eq diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala index 22336fde..a35a1727 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import io.circe.{ Codec, Decoder, Encoder } diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala index d3df583a..415ea81e 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import cats.Eq diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala b/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala index 6d64c743..747dd12a 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras.examples import cats.kernel.Eq diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala b/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala index 3fde79fe..1c7cef03 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2019 circe + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.generic.extras import cats.instances.AllInstances From 112774f19dd1733f99aec0398cf57289015762ad Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Thu, 13 Jun 2024 13:32:33 +0200 Subject: [PATCH 4/7] Run scalafix --- .scalafix.conf | 3 +++ .../benchmarks/RetryDecoderWithDefault.scala | 5 +++-- .../circe/generic/extras/AutoDerivation.scala | 3 ++- .../generic/extras/ConfigurableDeriver.scala | 10 ++++++--- .../circe/generic/extras/ExtrasDecoder.scala | 4 +++- .../codec/ConfiguredAsObjectCodec.scala | 19 ++++++++++++---- .../extras/codec/EnumerationCodec.scala | 19 +++++++++++++--- .../extras/codec/ReprAsObjectCodec.scala | 8 +++++-- .../generic/extras/codec/UnwrappedCodec.scala | 12 ++++++++-- .../extras/decoding/ConfiguredDecoder.scala | 20 ++++++++++++----- .../extras/decoding/EnumerationDecoder.scala | 17 +++++++++++--- .../IncompleteConfiguredDecoders.scala | 10 ++++++--- .../generic/extras/decoding/ReprDecoder.scala | 8 +++++-- .../extras/decoding/UnwrappedDecoder.scala | 9 ++++++-- .../encoding/ConfiguredAsObjectEncoder.scala | 14 ++++++++---- .../extras/encoding/EnumerationEncoder.scala | 17 ++++++++++---- .../extras/encoding/ReprAsObjectEncoder.scala | 5 ++++- .../extras/encoding/UnwrappedEncoder.scala | 9 ++++++-- .../io/circe/generic/extras/semiauto.scala | 22 ++++++++++++++----- .../generic/extras/util/RecordToMap.scala | 8 +++++-- .../io/circe/generic/extras/CirceSuite.scala | 4 ++-- .../extras/ConfiguredAutoDerivedSuite.scala | 8 +++++-- .../extras/ConfiguredJsonCodecSuite.scala | 6 +++-- .../ConfiguredJsonCodecWithKeySuite.scala | 6 +++-- .../ConfiguredSemiautoDerivedSuite.scala | 16 +++++++++----- .../EnumerationSemiautoDerivedSuite.scala | 4 +++- .../UnwrappedSemiautoDerivedSuite.scala | 3 ++- .../extras/examples/CardinalDirection.scala | 3 ++- .../generic/extras/examples/package.scala | 8 +++++-- 29 files changed, 211 insertions(+), 69 deletions(-) create mode 100644 .scalafix.conf diff --git a/.scalafix.conf b/.scalafix.conf new file mode 100644 index 00000000..edf55aee --- /dev/null +++ b/.scalafix.conf @@ -0,0 +1,3 @@ +rules = [ + OrganizeImports +] diff --git a/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala b/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala index 1e86f9e5..e1dd7cb5 100644 --- a/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala +++ b/benchmarks/src/main/scala/io/circe/generic/extras/benchmarks/RetryDecoderWithDefault.scala @@ -20,10 +20,11 @@ package benchmarks import io.circe.generic.extras.semiauto._ import io.circe.syntax._ -import java.util.UUID import org.openjdk.jmh.annotations._ -import scala.annotation.tailrec + +import java.util.UUID import java.util.concurrent.TimeUnit +import scala.annotation.tailrec @BenchmarkMode(Array(Mode.AverageTime)) @OutputTimeUnit(TimeUnit.MILLISECONDS) diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala b/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala index 1ee1d177..caa461df 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/AutoDerivation.scala @@ -16,7 +16,8 @@ package io.circe.generic.extras -import io.circe.{ Decoder, Encoder } +import io.circe.Decoder +import io.circe.Encoder import io.circe.export.Exported import io.circe.generic.extras.decoding.ConfiguredDecoder import io.circe.generic.extras.encoding.ConfiguredAsObjectEncoder diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala b/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala index 35754de2..90197f33 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/ConfigurableDeriver.scala @@ -16,10 +16,14 @@ package io.circe.generic.extras -import io.circe.generic.extras.codec.{ ConfiguredAsObjectCodec, ReprAsObjectCodec } -import io.circe.generic.extras.decoding.{ ConfiguredDecoder, ReprDecoder } -import io.circe.generic.extras.encoding.{ ConfiguredAsObjectEncoder, ReprAsObjectEncoder } +import io.circe.generic.extras.codec.ConfiguredAsObjectCodec +import io.circe.generic.extras.codec.ReprAsObjectCodec +import io.circe.generic.extras.decoding.ConfiguredDecoder +import io.circe.generic.extras.decoding.ReprDecoder +import io.circe.generic.extras.encoding.ConfiguredAsObjectEncoder +import io.circe.generic.extras.encoding.ReprAsObjectEncoder import io.circe.generic.util.macros.DerivationMacros + import scala.reflect.macros.whitebox class ConfigurableDeriver(val c: whitebox.Context) diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala index 19fa22ae..0491dc59 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/ExtrasDecoder.scala @@ -16,7 +16,9 @@ package io.circe.generic.extras -import io.circe.{ Decoder, DecodingFailure, HCursor } +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.HCursor /** * A derived decoder that includes additional functionality related to configuration. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala index 51adee01..e9bde350 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ConfiguredAsObjectCodec.scala @@ -16,17 +16,28 @@ package io.circe.generic.extras.codec -import io.circe.{ Decoder, Encoder, HCursor, JsonObject } +import io.circe.Decoder +import io.circe.Encoder +import io.circe.HCursor +import io.circe.JsonObject import io.circe.generic.codec.DerivedAsObjectCodec -import io.circe.generic.extras.{ Configuration, ExtrasDecoder, JsonKey } +import io.circe.generic.extras.Configuration +import io.circe.generic.extras.ExtrasDecoder +import io.circe.generic.extras.JsonKey import io.circe.generic.extras.decoding.ConfiguredDecoder import io.circe.generic.extras.encoding.ConfiguredAsObjectEncoder import io.circe.generic.extras.util.RecordToMap -import scala.annotation.implicitNotFound -import shapeless.{ Annotations, Coproduct, Default, HList, LabelledGeneric, Lazy } +import shapeless.Annotations +import shapeless.Coproduct +import shapeless.Default +import shapeless.HList +import shapeless.LabelledGeneric +import shapeless.Lazy import shapeless.ops.hlist.ToTraversable import shapeless.ops.record.Keys +import scala.annotation.implicitNotFound + @implicitNotFound( """Could not find ConfiguredAsObjectCodec for type ${A}. Some possible causes for this: diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala index c7c20970..fedee670 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/EnumerationCodec.scala @@ -16,11 +16,24 @@ package io.circe.generic.extras.codec -import io.circe.{ Codec, Decoder, DecodingFailure, HCursor, Json } +import io.circe.Codec +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.HCursor +import io.circe.Json import io.circe.generic.extras.Configuration +import shapeless.:+: +import shapeless.CNil +import shapeless.Coproduct +import shapeless.HNil +import shapeless.Inl +import shapeless.Inr +import shapeless.LabelledGeneric +import shapeless.Witness +import shapeless.labelled.FieldType +import shapeless.labelled.field + import scala.annotation.implicitNotFound -import shapeless.{ :+:, CNil, Coproduct, HNil, Inl, Inr, LabelledGeneric, Witness } -import shapeless.labelled.{ FieldType, field } @implicitNotFound( """Could not find EnumerationCodec for type ${A}. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala index c1a1cfd5..bb9decf2 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/ReprAsObjectCodec.scala @@ -17,13 +17,17 @@ package io.circe.generic.extras.codec import cats.data.Validated -import io.circe.{ Decoder, DecodingFailure, HCursor, JsonObject } +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.HCursor +import io.circe.JsonObject import io.circe.generic.extras.ConfigurableDeriver import io.circe.generic.extras.decoding.ReprDecoder import io.circe.generic.extras.encoding.ReprAsObjectEncoder +import shapeless.HNil + import scala.annotation.implicitNotFound import scala.collection.immutable.Map -import shapeless.HNil /** * A codec for a generic representation of a case class or ADT. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala b/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala index 4140df4b..f70c3edf 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/codec/UnwrappedCodec.scala @@ -16,9 +16,17 @@ package io.circe.generic.extras.codec -import io.circe.{ Codec, Decoder, Encoder, HCursor, Json } +import io.circe.Codec +import io.circe.Decoder +import io.circe.Encoder +import io.circe.HCursor +import io.circe.Json +import shapeless.:: +import shapeless.Generic +import shapeless.HNil +import shapeless.Lazy + import scala.annotation.implicitNotFound -import shapeless.{ ::, Generic, HNil, Lazy } @implicitNotFound( """Could not find UnwrappedCodec for type ${A}. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala index 25055789..23690dee 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ConfiguredDecoder.scala @@ -16,16 +16,26 @@ package io.circe.generic.extras.decoding -import io.circe.{ Decoder, DecodingFailure, HCursor } +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.HCursor import io.circe.generic.decoding.DerivedDecoder -import io.circe.generic.extras.{ Configuration, ExtrasDecoder, JsonKey } +import io.circe.generic.extras.Configuration +import io.circe.generic.extras.ExtrasDecoder +import io.circe.generic.extras.JsonKey import io.circe.generic.extras.util.RecordToMap +import shapeless.Annotations +import shapeless.Coproduct +import shapeless.Default +import shapeless.HList +import shapeless.LabelledGeneric +import shapeless.Lazy +import shapeless.ops.hlist.ToTraversable +import shapeless.ops.record.Keys + import java.util.concurrent.ConcurrentHashMap import scala.annotation.implicitNotFound import scala.collection.immutable.Map -import shapeless.{ Annotations, Coproduct, Default, HList, LabelledGeneric, Lazy } -import shapeless.ops.hlist.ToTraversable -import shapeless.ops.record.Keys @implicitNotFound( """Could not find ConfiguredDecoder for type ${A}. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala index 47b5315a..008a1147 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/EnumerationDecoder.scala @@ -16,11 +16,22 @@ package io.circe.generic.extras.decoding -import io.circe.{ Decoder, DecodingFailure, HCursor } +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.HCursor import io.circe.generic.extras.Configuration +import shapeless.:+: +import shapeless.CNil +import shapeless.Coproduct +import shapeless.HNil +import shapeless.Inl +import shapeless.Inr +import shapeless.LabelledGeneric +import shapeless.Witness +import shapeless.labelled.FieldType +import shapeless.labelled.field + import scala.annotation.implicitNotFound -import shapeless.{ :+:, CNil, Coproduct, HNil, Inl, Inr, LabelledGeneric, Witness } -import shapeless.labelled.{ FieldType, field } @implicitNotFound( """Could not find EnumerationDecoder for type ${A}. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala index 2c8f4bd8..6f22d797 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/IncompleteConfiguredDecoders.scala @@ -16,15 +16,19 @@ package io.circe.generic.extras.decoding -import io.circe.{ Decoder, HCursor } +import io.circe.Decoder +import io.circe.HCursor import io.circe.generic.extras.Configuration import io.circe.generic.extras.util.RecordToMap import io.circe.generic.util.PatchWithOptions -import scala.collection.immutable.Map -import shapeless.{ Default, HList, LabelledGeneric } +import shapeless.Default +import shapeless.HList +import shapeless.LabelledGeneric import shapeless.ops.function.FnFromProduct import shapeless.ops.record.RemoveAll +import scala.collection.immutable.Map + private[circe] trait IncompleteConfiguredDecoders { implicit final def decodeIncompleteCaseClass[F, P <: HList, A, D <: HList, T <: HList, R <: HList](implicit ffp: FnFromProduct.Aux[P => A, F], diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala index 8365f34c..18ef2a23 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/ReprDecoder.scala @@ -17,12 +17,16 @@ package io.circe.generic.extras.decoding import cats.data.Validated -import io.circe.{ ACursor, Decoder, DecodingFailure, HCursor } +import io.circe.ACursor +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.HCursor import io.circe.Json.JNull import io.circe.generic.extras.ConfigurableDeriver +import shapeless.HNil + import scala.annotation.implicitNotFound import scala.collection.immutable.Map -import shapeless.HNil /** * A decoder for a generic representation of a case class or ADT. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala index 8c1c2c5c..ef6b0846 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/decoding/UnwrappedDecoder.scala @@ -16,9 +16,14 @@ package io.circe.generic.extras.decoding -import io.circe.{ Decoder, HCursor } +import io.circe.Decoder +import io.circe.HCursor +import shapeless.:: +import shapeless.Generic +import shapeless.HNil +import shapeless.Lazy + import scala.annotation.implicitNotFound -import shapeless.{ ::, Generic, HNil, Lazy } @implicitNotFound( """Could not find UnwrappedDecoder for type ${A}. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala index 80918cb1..0fbbec46 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ConfiguredAsObjectEncoder.scala @@ -18,13 +18,19 @@ package io.circe.generic.extras.encoding import io.circe.JsonObject import io.circe.generic.encoding.DerivedAsObjectEncoder -import io.circe.generic.extras.{ Configuration, JsonKey } +import io.circe.generic.extras.Configuration +import io.circe.generic.extras.JsonKey +import shapeless.Annotations +import shapeless.Coproduct +import shapeless.HList +import shapeless.LabelledGeneric +import shapeless.Lazy +import shapeless.ops.hlist.ToTraversable +import shapeless.ops.record.Keys + import java.util.concurrent.ConcurrentHashMap import scala.annotation.implicitNotFound import scala.collection.immutable.Map -import shapeless.{ Annotations, Coproduct, HList, LabelledGeneric, Lazy } -import shapeless.ops.hlist.ToTraversable -import shapeless.ops.record.Keys @implicitNotFound( """Could not find ConfiguredAsObjectEncoder for type ${A}. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala index 169432e7..410996fb 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/EnumerationEncoder.scala @@ -16,13 +16,22 @@ package io.circe.generic.extras.encoding -import io.circe.{ Encoder, Json } +import io.circe.Encoder +import io.circe.Json import io.circe.generic.extras.Configuration - -import scala.annotation.{ implicitNotFound, nowarn } -import shapeless.{ :+:, CNil, Coproduct, HNil, Inl, Inr, LabelledGeneric, Witness } +import shapeless.:+: +import shapeless.CNil +import shapeless.Coproduct +import shapeless.HNil +import shapeless.Inl +import shapeless.Inr +import shapeless.LabelledGeneric +import shapeless.Witness import shapeless.labelled.FieldType +import scala.annotation.implicitNotFound +import scala.annotation.nowarn + @implicitNotFound( """Could not find EnumerationEncoder for type ${A}. Some possible causes for this: diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala index 0833c16e..21cb80c2 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/ReprAsObjectEncoder.scala @@ -16,8 +16,11 @@ package io.circe.generic.extras.encoding -import io.circe.{ Encoder, Json, JsonObject } +import io.circe.Encoder +import io.circe.Json +import io.circe.JsonObject import io.circe.generic.extras.ConfigurableDeriver + import scala.annotation.implicitNotFound /** diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala index 3c6147a0..f8015b19 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/encoding/UnwrappedEncoder.scala @@ -16,9 +16,14 @@ package io.circe.generic.extras.encoding -import io.circe.{ Encoder, Json } +import io.circe.Encoder +import io.circe.Json +import shapeless.:: +import shapeless.Generic +import shapeless.HNil +import shapeless.Lazy + import scala.annotation.implicitNotFound -import shapeless.{ ::, Generic, HNil, Lazy } @implicitNotFound( """Could not find UnwrappedEncoder for type ${A}. diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala b/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala index 6e56c284..b35962bc 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/semiauto.scala @@ -16,13 +16,25 @@ package io.circe.generic.extras -import io.circe.{ Codec, Decoder, Encoder } -import io.circe.generic.extras.codec.{ ConfiguredAsObjectCodec, EnumerationCodec, UnwrappedCodec } -import io.circe.generic.extras.decoding.{ ConfiguredDecoder, EnumerationDecoder, ReprDecoder, UnwrappedDecoder } -import io.circe.generic.extras.encoding.{ ConfiguredAsObjectEncoder, EnumerationEncoder, UnwrappedEncoder } +import io.circe.Codec +import io.circe.Decoder +import io.circe.Encoder +import io.circe.generic.extras.codec.ConfiguredAsObjectCodec +import io.circe.generic.extras.codec.EnumerationCodec +import io.circe.generic.extras.codec.UnwrappedCodec +import io.circe.generic.extras.decoding.ConfiguredDecoder +import io.circe.generic.extras.decoding.EnumerationDecoder +import io.circe.generic.extras.decoding.ReprDecoder +import io.circe.generic.extras.decoding.UnwrappedDecoder +import io.circe.generic.extras.encoding.ConfiguredAsObjectEncoder +import io.circe.generic.extras.encoding.EnumerationEncoder +import io.circe.generic.extras.encoding.UnwrappedEncoder import io.circe.generic.extras.util.RecordToMap import io.circe.generic.util.PatchWithOptions -import shapeless.{ Default, HList, LabelledGeneric, Lazy } +import shapeless.Default +import shapeless.HList +import shapeless.LabelledGeneric +import shapeless.Lazy import shapeless.ops.function.FnFromProduct import shapeless.ops.record.RemoveAll diff --git a/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala b/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala index 39183a5e..fe7343c0 100644 --- a/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala +++ b/generic-extras/src/main/scala/io/circe/generic/extras/util/RecordToMap.scala @@ -16,10 +16,14 @@ package io.circe.generic.extras.util -import scala.collection.immutable.Map -import shapeless.{ ::, HList, HNil, Witness } +import shapeless.:: +import shapeless.HList +import shapeless.HNil +import shapeless.Witness import shapeless.labelled.FieldType +import scala.collection.immutable.Map + abstract class RecordToMap[R <: HList] { def apply(r: R): Map[String, Any] } diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala index 588aa833..f93fcff2 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/CirceSuite.scala @@ -18,8 +18,8 @@ package io.circe.generic.extras import cats.instances._ import cats.syntax._ -import io.circe.testing.{ ArbitraryInstances, EqInstances } - +import io.circe.testing.ArbitraryInstances +import io.circe.testing.EqInstances import munit.DisciplineSuite /** diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala index 7f845e27..c6bf89ce 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredAutoDerivedSuite.scala @@ -18,13 +18,17 @@ package io.circe.generic.extras import cats.data.Validated import cats.kernel.Eq -import io.circe.{ Decoder, DecodingFailure, Encoder, Json } import io.circe.CursorOp.DownField +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.Encoder +import io.circe.Json import io.circe.generic.extras.auto._ import io.circe.literal._ import io.circe.testing.CodecTests -import org.scalacheck.{ Arbitrary, Gen } +import org.scalacheck.Arbitrary import org.scalacheck.Arbitrary.arbitrary +import org.scalacheck.Gen import org.scalacheck.Prop.forAll import examples._ diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala index bb9763b9..bd93a16c 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecSuite.scala @@ -17,11 +17,13 @@ package io.circe.generic.extras import cats.kernel.Eq -import io.circe.{ Decoder, Encoder } +import io.circe.Decoder +import io.circe.Encoder import io.circe.literal._ import io.circe.testing.CodecTests +import org.scalacheck.Arbitrary +import org.scalacheck.Gen import org.scalacheck.Prop.forAll -import org.scalacheck.{ Arbitrary, Gen } object ConfiguredJsonCodecSuite { implicit val customConfig: Configuration = diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala index fde26a0b..103e6ab6 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredJsonCodecWithKeySuite.scala @@ -17,11 +17,13 @@ package io.circe.generic.extras import cats.kernel.Eq -import io.circe.{ Decoder, Encoder } +import io.circe.Decoder +import io.circe.Encoder import io.circe.literal._ import io.circe.testing.CodecTests -import org.scalacheck.{ Arbitrary, Gen } +import org.scalacheck.Arbitrary import org.scalacheck.Arbitrary.arbitrary +import org.scalacheck.Gen import org.scalacheck.Prop.forAll object ConfiguredJsonCodecWithKeySuite { diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala index 25c10658..1a48e773 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/ConfiguredSemiautoDerivedSuite.scala @@ -17,16 +17,22 @@ package io.circe.generic.extras import cats.kernel.Eq -import io.circe.{ Codec, Decoder, DecodingFailure, Encoder, Json } +import io.circe.Codec +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.Encoder +import io.circe.Json import io.circe.generic.extras.semiauto._ import io.circe.literal._ -import io.circe.testing.CodecTests import io.circe.syntax._ -import org.scalacheck.{ Arbitrary, Gen } +import io.circe.testing.CodecTests +import org.scalacheck.Arbitrary import org.scalacheck.Arbitrary.arbitrary -import shapeless.Witness -import shapeless.labelled.{ FieldType, field } +import org.scalacheck.Gen import org.scalacheck.Prop.forAll +import shapeless.Witness +import shapeless.labelled.FieldType +import shapeless.labelled.field import examples._ diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala index a35a1727..2eb76491 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/EnumerationSemiautoDerivedSuite.scala @@ -16,7 +16,9 @@ package io.circe.generic.extras -import io.circe.{ Codec, Decoder, Encoder } +import io.circe.Codec +import io.circe.Decoder +import io.circe.Encoder import io.circe.generic.extras.semiauto._ import io.circe.literal._ import io.circe.testing.CodecTests diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala b/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala index 415ea81e..f72b6e3c 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/UnwrappedSemiautoDerivedSuite.scala @@ -20,8 +20,9 @@ import cats.Eq import io.circe._ import io.circe.generic.extras.semiauto._ import io.circe.testing.CodecTests -import org.scalacheck.{ Arbitrary, Gen } +import org.scalacheck.Arbitrary import org.scalacheck.Arbitrary.arbitrary +import org.scalacheck.Gen import org.scalacheck.Prop.forAll object UnwrappedSemiautoDerivedSuite { diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala b/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala index 747dd12a..b80e4a1d 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/examples/CardinalDirection.scala @@ -17,7 +17,8 @@ package io.circe.generic.extras.examples import cats.kernel.Eq -import org.scalacheck.{ Arbitrary, Gen } +import org.scalacheck.Arbitrary +import org.scalacheck.Gen sealed trait CardinalDirection case object North extends CardinalDirection diff --git a/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala b/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala index 1c7cef03..0a271382 100644 --- a/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala +++ b/generic-extras/src/test/scala/io/circe/generic/extras/examples/package.scala @@ -19,9 +19,13 @@ package io.circe.generic.extras import cats.instances.AllInstances import cats.kernel.Eq import cats.syntax.functor._ -import io.circe.{ Decoder, DecodingFailure, Encoder, Json } +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.Encoder +import io.circe.Json import io.circe.testing.ArbitraryInstances -import org.scalacheck.{ Arbitrary, Gen } +import org.scalacheck.Arbitrary +import org.scalacheck.Gen package object examples extends AllInstances with ArbitraryInstances { val glossary: Json = Json.obj( From 92d625a9b58b3f1bd342bf5052b404ed9c91c86b Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Thu, 13 Jun 2024 13:50:15 +0200 Subject: [PATCH 5/7] remove fatal warnings for test --- .github/workflows/ci.yml | 2 +- build.sbt | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c35ddcfb..8e4691bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -315,6 +315,6 @@ jobs: - run: sbt '++ ${{ matrix.scala }}' coverage rootJVM/test coverageAggregate - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v4 with: flags: ${{matrix.scala}},${{matrix.java}} diff --git a/build.sbt b/build.sbt index 894f7185..9c6cffef 100644 --- a/build.sbt +++ b/build.sbt @@ -11,7 +11,8 @@ val munitVersion = "0.7.29" val disciplineMunitVersion = "1.0.9" ThisBuild / tlBaseVersion := "0.14" -ThisBuild / tlCiReleaseTags := false +ThisBuild / tlCiReleaseTags := true +ThisBuild / tlFatalWarnings := false // we currently have a lot of warnings that will need to be fixed ThisBuild / organization := "io.circe" ThisBuild / crossScalaVersions := List(Scala212V, Scala213V) @@ -34,7 +35,7 @@ ThisBuild / githubWorkflowAddedJobs ++= Seq( UseRef.Public( "codecov", "codecov-action", - "v2" + "v4" ), params = Map( "flags" -> List("${{matrix.scala}}", "${{matrix.java}}").mkString(",") @@ -44,6 +45,12 @@ ThisBuild / githubWorkflowAddedJobs ++= Seq( ) ) +def do_configure(project: Project) = project.settings( + Seq( + Test / scalacOptions -= "-Xfatal-warnings" + ) +) + //val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs") lazy val root = @@ -90,6 +97,7 @@ lazy val genericExtras = crossProject(JSPlatform, JVMPlatform, NativePlatform) .nativeSettings( tlVersionIntroduced := List("2.12", "2.13").map(_ -> "0.14.3").toMap ) + .configure(do_configure) lazy val benchmarks = project .in(file("benchmarks")) From 397690919bf3972096da1e6b686689e28d31bb34 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Thu, 13 Jun 2024 13:53:33 +0200 Subject: [PATCH 6/7] publishing enabled --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e4691bd..9628c432 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,15 +103,15 @@ jobs: run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc - name: Make target directories - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') run: mkdir -p generic-extras/.js/target generic-extras/.jvm/target generic-extras/.native/target project/target - name: Compress target directories - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') run: tar cf targets.tar generic-extras/.js/target generic-extras/.jvm/target generic-extras/.native/target project/target - name: Upload target directories - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') uses: actions/upload-artifact@v4 with: name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} @@ -120,7 +120,7 @@ jobs: publish: name: Publish Artifacts needs: [build] - if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main') + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') strategy: matrix: os: [ubuntu-latest] From 33396a91bee68273b4b2b9df985a70d95e772640 Mon Sep 17 00:00:00 2001 From: Erlend Hamnaberg Date: Thu, 13 Jun 2024 14:02:31 +0200 Subject: [PATCH 7/7] codecov uprade and config file --- .codecov.yml | 5 +++++ project/plugins.sbt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000..5077db30 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + project: + default: + threshold: 5% diff --git a/project/plugins.sbt b/project/plugins.sbt index 010ce086..c44a7f36 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7") addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.1")