diff --git a/.scalafmt.conf b/.scalafmt.conf index 47933f6f..d0eb0ae9 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,6 +1,9 @@ # https://scalameta.org/scalafmt/docs/configuration.html version = "3.0.6" -align.preset = more +runner.dialect = scala213source3 +preset = defaultWithAlign +align.preset = most +align.multiline = false assumeStandardLibraryStripMargin = true danglingParentheses.preset = true maxColumn = 140 @@ -9,8 +12,11 @@ rewrite.rules = [ PreferCurlyFors, RedundantBraces, RedundantParens, - SortImports + SortImports, + SortModifiers ] +rewrite.redundantBraces.stringInterpolation = true +rewrite.redundantBraces.parensForOneLineApply = true rewrite.neverInfix.excludeFilters = [ until to diff --git a/src/main/scala/scynamo/ScynamoDecoder.scala b/src/main/scala/scynamo/ScynamoDecoder.scala index df763705..48469848 100644 --- a/src/main/scala/scynamo/ScynamoDecoder.scala +++ b/src/main/scala/scynamo/ScynamoDecoder.scala @@ -208,7 +208,7 @@ trait ScynamoIterableDecoder extends LowestPrioAutoDecoder { } trait LowestPrioAutoDecoder { - final implicit def autoDerivedScynamoDecoder[A: AutoDerivationUnlocked](implicit + implicit final def autoDerivedScynamoDecoder[A: AutoDerivationUnlocked](implicit genericDecoder: Lazy[GenericScynamoDecoder[A]] ): ObjectScynamoDecoder[A] = scynamo.generic.semiauto.deriveScynamoDecoder[A] diff --git a/src/main/scala/scynamo/ScynamoEncoder.scala b/src/main/scala/scynamo/ScynamoEncoder.scala index 0c3bb976..a98a258b 100644 --- a/src/main/scala/scynamo/ScynamoEncoder.scala +++ b/src/main/scala/scynamo/ScynamoEncoder.scala @@ -176,7 +176,7 @@ trait ScynamoIterableEncoder extends LowestPrioAutoEncoder { } trait LowestPrioAutoEncoder { - final implicit def autoDerivedScynamoEncoder[A: AutoDerivationUnlocked](implicit + implicit final def autoDerivedScynamoEncoder[A: AutoDerivationUnlocked](implicit genericEncoder: Lazy[GenericScynamoEncoder[A]] ): ObjectScynamoEncoder[A] = scynamo.generic.semiauto.deriveScynamoEncoder[A] diff --git a/src/main/scala/scynamo/generic/ShapelessScynamoDecoder.scala b/src/main/scala/scynamo/generic/ShapelessScynamoDecoder.scala index 7f6b859b..ae82d6c7 100644 --- a/src/main/scala/scynamo/generic/ShapelessScynamoDecoder.scala +++ b/src/main/scala/scynamo/generic/ShapelessScynamoDecoder.scala @@ -60,9 +60,8 @@ trait DecoderCoproductInstances extends ScynamoDecoderFunctions { ): ShapelessScynamoDecoder[Base, FieldType[K, V] :+: T] = { attributes => val name = opts.transform(key.value.name) for { - typeTagAttrValue <- Option(attributes.get(opts.discriminator)) - .toRightNec(ScynamoDecodeError.missingField(name, attributes)) - typeTag <- typeTagAttrValue.asEither(ScynamoType.String) + typeTagAttrValue <- Option(attributes.get(opts.discriminator)).toRightNec(ScynamoDecodeError.missingField(name, attributes)) + typeTag <- typeTagAttrValue.asEither(ScynamoType.String) result <- if (name == typeTag) { val attr = AttributeValue.builder.m(attributes).build() diff --git a/src/main/scala/scynamo/generic/auto/package.scala b/src/main/scala/scynamo/generic/auto/package.scala index 8e8b17be..b597b2a5 100644 --- a/src/main/scala/scynamo/generic/auto/package.scala +++ b/src/main/scala/scynamo/generic/auto/package.scala @@ -5,4 +5,4 @@ package object auto { implicit val unlocker: AutoDerivationUnlocker = new AutoDerivationUnlocker {} } -private[scynamo] sealed abstract class AutoDerivationUnlocker +sealed abstract private[scynamo] class AutoDerivationUnlocker diff --git a/src/test/scala/scynamo/ScynamoInstancesTest.scala b/src/test/scala/scynamo/ScynamoInstancesTest.scala index dedbcd9b..c217bec3 100644 --- a/src/test/scala/scynamo/ScynamoInstancesTest.scala +++ b/src/test/scala/scynamo/ScynamoInstancesTest.scala @@ -21,7 +21,7 @@ class ScynamoInstancesTest extends AnyFunSuite with Checkers with FunSuiteDiscip import ScynamoInstancesTest.ArbitraryError type AttributeMap = java.util.Map[String, AttributeValue] - override implicit val generatorDrivenConfig: PropertyCheckConfiguration = + implicit override val generatorDrivenConfig: PropertyCheckConfiguration = checkConfiguration implicit def arbitraryJavaMap[K: Arbitrary, V: Arbitrary]: Arbitrary[java.util.Map[K, V]] = diff --git a/src/test/scala/scynamo/ScynamoTest.scala b/src/test/scala/scynamo/ScynamoTest.scala index dd6240af..4f5ba9a6 100644 --- a/src/test/scala/scynamo/ScynamoTest.scala +++ b/src/test/scala/scynamo/ScynamoTest.scala @@ -42,8 +42,8 @@ class ScynamoTest extends UnitTest { val result = for { encodedInput <- input.encodedMap - response = GetItemResponse.builder().item(encodedInput).build() - result <- Scynamo.decodeGetItemResponse[Map[String, String]](response) + response = GetItemResponse.builder().item(encodedInput).build() + result <- Scynamo.decodeGetItemResponse[Map[String, String]](response) } yield result result should ===(Right(Some(input))) @@ -56,8 +56,8 @@ class ScynamoTest extends UnitTest { val result = for { encodedInput1 <- input1.encodedMap encodedInput2 <- input2.encodedMap - response = QueryResponse.builder().items(encodedInput1, encodedInput2).build() - result <- Scynamo.decodeQueryResponse[Map[String, String]](response) + response = QueryResponse.builder().items(encodedInput1, encodedInput2).build() + result <- Scynamo.decodeQueryResponse[Map[String, String]](response) } yield result result should ===(Right(List(input1, input2))) } @@ -69,8 +69,8 @@ class ScynamoTest extends UnitTest { val result = for { encodedInput1 <- input1.encodedMap encodedInput2 <- input2.encodedMap - response = ScanResponse.builder().items(encodedInput1, encodedInput2).build() - result <- Scynamo.decodeScanResponse[Map[String, String]](response) + response = ScanResponse.builder().items(encodedInput1, encodedInput2).build() + result <- Scynamo.decodeScanResponse[Map[String, String]](response) } yield result result should ===(Right(List(input1, input2))) }