Skip to content

Commit

Permalink
Add required Scalafmt runner (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeltz authored Oct 7, 2021
1 parent 1aa144e commit 475953a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
10 changes: 8 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/scynamo/ScynamoDecoder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/scynamo/ScynamoEncoder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
5 changes: 2 additions & 3 deletions src/main/scala/scynamo/generic/ShapelessScynamoDecoder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/scynamo/generic/auto/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/test/scala/scynamo/ScynamoInstancesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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]] =
Expand Down
12 changes: 6 additions & 6 deletions src/test/scala/scynamo/ScynamoTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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)))
}
Expand All @@ -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)))
}
Expand Down

0 comments on commit 475953a

Please sign in to comment.