Skip to content

Commit

Permalink
Update scalafmt-core to 3.8.3 (#383)
Browse files Browse the repository at this point in the history
* Update scalafmt-core to 3.8.3

* Reformat with scalafmt 3.8.3

Executed command: scalafmt --non-interactive

* Add 'Reformat with scalafmt 3.8.3' to .git-blame-ignore-revs
  • Loading branch information
scala-steward authored Sep 13, 2024
1 parent 0b796fb commit c36a898
Show file tree
Hide file tree
Showing 14 changed files with 207 additions and 155 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 3.8.3
dd03855a8943550d9bc1d7c0eeb2b13745c1fc46
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.2
version = 3.8.3

runner.dialect = scala3
style = defaultWithAlign
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package pl.iterators.kebs.support

trait FractionalSupport {

implicit def fractionalFromValueClassLike[A, Rep](implicit vcLike: ValueClassLike[A, Rep],
fractionalRep: Fractional[Rep],
numeric: Numeric[A]): Fractional[A] =
implicit def fractionalFromValueClassLike[A, Rep](implicit
vcLike: ValueClassLike[A, Rep],
fractionalRep: Fractional[Rep],
numeric: Numeric[A]
): Fractional[A] =
new Fractional[A] {
override def div(x: A, y: A): A = vcLike.apply(fractionalRep.div(vcLike.unapply(x), vcLike.unapply(y)))
override def plus(x: A, y: A): A = numeric.plus(x, y)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package pl.iterators.kebs.support

trait IntegralSupport {

implicit def integralFromValueClassLike[A, Rep](implicit vcLike: ValueClassLike[A, Rep],
integralRep: Integral[Rep],
numeric: Numeric[A]): Integral[A] =
implicit def integralFromValueClassLike[A, Rep](implicit
vcLike: ValueClassLike[A, Rep],
integralRep: Integral[Rep],
numeric: Numeric[A]
): Integral[A] =
new Integral[A] {
override def quot(x: A, y: A): A = vcLike.apply(integralRep.quot(vcLike.unapply(x), vcLike.unapply(y)))
override def rem(x: A, y: A): A = vcLike.apply(integralRep.rem(vcLike.unapply(x), vcLike.unapply(y)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ object CirceExample {

case class Thing(id: ThingId, name: ThingName, description: ThingDescription, pictureUrl: URL, tags: List[TagId], location: Location)

case class ThingCreateRequest(name: ThingName,
description: ThingDescription,
pictureUrl: Option[URL],
tags: List[TagId],
location: Location)
case class ThingCreateRequest(
name: ThingName,
description: ThingDescription,
pictureUrl: Option[URL],
tags: List[TagId],
location: Location
)
sealed abstract class ThingCreateResponse
object ThingCreateResponse {
case class Created(thing: Thing) extends ThingCreateResponse
Expand Down Expand Up @@ -125,8 +127,8 @@ trait CircePekkoHttpSupport {
case data => parseByteBuffer(data.asByteBuffer).fold(throw _, identity)
}

implicit def jsonMarshaller(
implicit printer: Printer = Printer.noSpaces
implicit def jsonMarshaller(implicit
printer: Printer = Printer.noSpaces
): ToEntityMarshaller[Json] =
Marshaller.oneOf(mediaTypes: _*) { mediaType =>
Marshaller.withFixedContentType(ContentType(mediaType)) { json =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ object EnumSprayJsonFormat {
.getOrElse(deserializationError(s"$name should be one of (${enumCompanion.values.map(_.entryName).mkString(", ")})"))
case _ =>
deserializationError(
s"${json.toString()} should be a string of value (${enumCompanion.values.map(_.entryName).mkString(", ")})")
s"${json.toString()} should be a string of value (${enumCompanion.values.map(_.entryName).mkString(", ")})"
)
}

override def write(obj: T): JsValue = JsString(obj.entryName)
Expand Down Expand Up @@ -137,30 +138,36 @@ object EnumSprayJsonFormat {
override val values = findValues
}

case class Thing(id: ThingId,
name: ThingName,
description: ThingDescription,
pictureUrl: URL,
tags: List[TagId],
location: Location,
status: ThingStatus)

case class ThingCreateRequest(name: ThingName,
description: ThingDescription,
pictureUrl: Option[URL],
tags: List[TagId],
location: Location)
case class Thing(
id: ThingId,
name: ThingName,
description: ThingDescription,
pictureUrl: URL,
tags: List[TagId],
location: Location,
status: ThingStatus
)

case class ThingCreateRequest(
name: ThingName,
description: ThingDescription,
pictureUrl: Option[URL],
tags: List[TagId],
location: Location
)
sealed abstract class ThingCreateResponse
object ThingCreateResponse {
case class Created(thing: Thing) extends ThingCreateResponse
case object AlreadyExists extends ThingCreateResponse
}

case class ThingUpdateRequest(name: Option[ThingName],
description: Option[ThingDescription],
tags: Option[List[TagId]],
location: Option[Location],
status: Option[ThingStatus])
case class ThingUpdateRequest(
name: Option[ThingName],
description: Option[ThingDescription],
tags: Option[List[TagId]],
location: Option[Location],
status: Option[ThingStatus]
)

sealed trait ThingUpdateResponse
object ThingUpdateResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ object EnumValueColumnType {
override def toString: String = s"${addressLine1.line} ${addressLine2.map(_.line).getOrElse("")}, ${city.city}"
}

case class BillingInfo(address: Address,
taxId: TaxId,
bankName: BankName,
bankAccountNumber: BankAccountNumber,
recipientName: RecipientName,
additionalInfo: AdditionalInfo)
case class BillingInfo(
address: Address,
taxId: TaxId,
bankName: BankName,
bankAccountNumber: BankAccountNumber,
recipientName: RecipientName,
additionalInfo: AdditionalInfo
)

case class Mobile(countryCode: String, number: String)

Expand All @@ -173,12 +175,14 @@ object EnumValueColumnType {
override val values = findValues
}

case class Person(userId: UserId,
emailAddress: EmailAddress,
fullName: FullName,
mobile: Mobile,
billingInfo: BillingInfo,
workCity: City,
workArea: Area,
status: WorkerAccountStatus)
case class Person(
userId: UserId,
emailAddress: EmailAddress,
fullName: FullName,
mobile: Mobile,
billingInfo: BillingInfo,
workCity: City,
workArea: Area,
status: WorkerAccountStatus
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,24 @@ object HStoreColumnType {
import MyPostgresProfile.api._

class HStoreTestTable(tag: Tag)
extends Table[(
Long,
Map[LanguageName, LanguageImportance],
Map[CategoryName, CategoryImportance],
Map[YearMonth, Boolean]
)](tag, "HStoreTest") {
extends Table[
(
Long,
Map[LanguageName, LanguageImportance],
Map[CategoryName, CategoryImportance],
Map[YearMonth, Boolean]
)
](tag, "HStoreTest") {
def id = column[Long]("id", O.AutoInc, O.PrimaryKey)
def languages = column[Map[LanguageName, LanguageImportance]]("languages")
def categories = column[Map[CategoryName, CategoryImportance]]("categories")
def history: Rep[Map[String, String]] = column[Map[String, String]]("history")

def historyMapped: MappedProjection[Map[YearMonth, Boolean], Map[String, String]] =
history.<>(h => h.map(kv => yearMonthIso.comap(kv._1) -> kv._2.toBoolean),
h => Option(h.map(kv => yearMonthIso.map(kv._1) -> kv._2.toString)))
history.<>(
h => h.map(kv => yearMonthIso.comap(kv._1) -> kv._2.toBoolean),
h => Option(h.map(kv => yearMonthIso.map(kv._1) -> kv._2.toString))
)

def * = (id, languages, categories, historyMapped)
}
Expand All @@ -82,12 +86,14 @@ object HStoreColumnType {

import MyPostgresProfile.api._
class HStoreTestTable(tag: Tag)
extends Table[(
Long,
Map[LanguageName, LanguageImportance],
Map[CategoryName, CategoryImportance],
Map[YearMonth, Boolean]
)](tag, "HStoreTest") {
extends Table[
(
Long,
Map[LanguageName, LanguageImportance],
Map[CategoryName, CategoryImportance],
Map[YearMonth, Boolean]
)
](tag, "HStoreTest") {
def id = column[Long]("id", O.AutoInc, O.PrimaryKey)
def languages = column[Map[LanguageName, LanguageImportance]]("languages")
def categories = column[Map[CategoryName, CategoryImportance]]("categories")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ object HStoreExtensionMethods {
def history: Rep[Map[String, String]] = column[Map[String, String]]("history")

def historyMapped: MappedProjection[Map[YearMonth, Boolean], Map[String, String]] =
history.<>(h => h.map(kv => yearMonthIso.comap(kv._1) -> kv._2.toBoolean),
h => Option(h.map(kv => yearMonthIso.map(kv._1) -> kv._2.toString)))
history.<>(
h => h.map(kv => yearMonthIso.comap(kv._1) -> kv._2.toBoolean),
h => Option(h.map(kv => yearMonthIso.map(kv._1) -> kv._2.toString))
)

def * = (id, historyMapped)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,36 @@ object PekkoHttpUnmarshallers {
case class PaginationQuery(sortBy: Column, sortOrder: SortOrder, offset: Offset, limit: Limit)

object BeforeKebs {
final def enumUnmarshaller[E <: EnumEntry](`enum`: Enum[E]): FromStringUnmarshaller[E] = Unmarshaller { _ =>name =>
final def enumUnmarshaller[E <: EnumEntry](`enum`: Enum[E]): FromStringUnmarshaller[E] = Unmarshaller { _ => name =>
`enum`.withNameInsensitiveOption(name) match {
case Some(enumEntry) => FastFuture.successful(enumEntry)
case None =>
FastFuture.failed(new IllegalArgumentException(s"""Invalid value '$name'. Expected one of: ${`enum`.namesToValuesMap.keysIterator
.mkString(", ")}"""))
.mkString(", ")}"""))
}
}
final def valueEnumUnmarshaller[V, E <: ValueEnumEntry[V]](`enum`: ValueEnum[V, E]): Unmarshaller[V, E] = Unmarshaller { _ =>v =>
final def valueEnumUnmarshaller[V, E <: ValueEnumEntry[V]](`enum`: ValueEnum[V, E]): Unmarshaller[V, E] = Unmarshaller { _ => v =>
`enum`.withValueOpt(v) match {
case Some(enumEntry) => FastFuture.successful(enumEntry)
case None =>
FastFuture.failed(new IllegalArgumentException(s"""Invalid value '$v'. Expected one of: ${`enum`.valuesToEntriesMap.keysIterator
.mkString(", ")}"""))
.mkString(", ")}"""))
}
}

implicit val fromStringLimitUnmarshaller: FromStringUnmarshaller[Limit] = Unmarshaller.intFromStringUnmarshaller map Limit
implicit val fromStringOffsetUnmarshaller: FromStringUnmarshaller[Offset] = Unmarshaller.intFromStringUnmarshaller map Offset
implicit val fromStringSortOrderUnmarshaller: FromStringUnmarshaller[SortOrder] = enumUnmarshaller(SortOrder)
implicit val fromStringColumnUnmarshaller
: FromStringUnmarshaller[Column] = Unmarshaller.intFromStringUnmarshaller andThen valueEnumUnmarshaller(Column)
implicit val fromStringColumnUnmarshaller: FromStringUnmarshaller[Column] =
Unmarshaller.intFromStringUnmarshaller andThen valueEnumUnmarshaller(Column)

val route = get {
parameters(Symbol("sortBy").as[Column],
Symbol("order").as[SortOrder] ? (SortOrder.Desc: SortOrder),
Symbol("offset").as[Offset] ? Offset(0),
Symbol("limit").as[Limit])
parameters(
Symbol("sortBy").as[Column],
Symbol("order").as[SortOrder] ? (SortOrder.Desc: SortOrder),
Symbol("offset").as[Offset] ? Offset(0),
Symbol("limit").as[Limit]
)
.as(PaginationQuery) { query =>
complete(StatusCodes.OK)
}
Expand All @@ -68,10 +70,12 @@ object PekkoHttpUnmarshallers {
object AfterKebs {

val route = get {
parameters(Symbol("sortBy").as[Column],
Symbol("order").as[SortOrder] ? (SortOrder.Desc: SortOrder),
Symbol("offset").as[Offset] ? Offset(0),
Symbol("limit").as[Limit])
parameters(
Symbol("sortBy").as[Column],
Symbol("order").as[SortOrder] ? (SortOrder.Desc: SortOrder),
Symbol("offset").as[Offset] ? Offset(0),
Symbol("limit").as[Limit]
)
.as(PaginationQuery) { query =>
complete(StatusCodes.OK)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,36 @@ object PlayJsonFormat {
override val values = findValues
}

case class Thing(id: ThingId,
name: ThingName,
description: ThingDescription,
pictureUrl: URL,
tags: List[TagId],
location: Location,
status: ThingStatus)

case class ThingCreateRequest(name: ThingName,
description: ThingDescription,
pictureUrl: Option[URL],
tags: List[TagId],
location: Location)
case class Thing(
id: ThingId,
name: ThingName,
description: ThingDescription,
pictureUrl: URL,
tags: List[TagId],
location: Location,
status: ThingStatus
)

case class ThingCreateRequest(
name: ThingName,
description: ThingDescription,
pictureUrl: Option[URL],
tags: List[TagId],
location: Location
)
sealed abstract class ThingCreateResponse
object ThingCreateResponse {
case class Created(thing: Thing) extends ThingCreateResponse
case object AlreadyExists extends ThingCreateResponse
}

case class ThingUpdateRequest(name: Option[ThingName],
description: Option[ThingDescription],
tags: Option[List[TagId]],
location: Option[Location],
status: Option[ThingStatus])
case class ThingUpdateRequest(
name: Option[ThingName],
description: Option[ThingDescription],
tags: Option[List[TagId]],
location: Option[Location],
status: Option[ThingStatus]
)

sealed trait ThingUpdateResponse
object ThingUpdateResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ object SprayJsonFormat {

case class Thing(id: ThingId, name: ThingName, description: ThingDescription, pictureUri: URI, tags: List[TagId], location: Location)

case class ThingCreateRequest(name: ThingName,
description: ThingDescription,
pictureUrl: Option[URI],
tags: List[TagId],
location: Location)
case class ThingCreateRequest(
name: ThingName,
description: ThingDescription,
pictureUrl: Option[URI],
tags: List[TagId],
location: Location
)
sealed abstract class ThingCreateResponse
object ThingCreateResponse {
case class Created(thing: Thing) extends ThingCreateResponse
Expand Down
Loading

0 comments on commit c36a898

Please sign in to comment.