Reformat with scalafmt 3.0.0

This commit is contained in:
Scala Steward
2021-08-19 08:50:30 +02:00
parent 5a2a0295ef
commit e4fecefaea
127 changed files with 558 additions and 658 deletions

View File

@ -54,12 +54,12 @@ object Config {
lazy val ipParts = ip.split('.')
def checkSingle(pattern: String): Boolean =
pattern == ip || (inet.isLoopbackAddress && pattern == "127.0.0.1") || (pattern
pattern == ip || (inet.isLoopbackAddress && pattern == "127.0.0.1") || pattern
.split('.')
.zip(ipParts)
.foldLeft(true) { case (r, (a, b)) =>
r && (a == "*" || a == b)
})
}
ips.exists(checkSingle)
}

View File

@ -91,10 +91,10 @@ object RestServer {
"usertask/notifydueitems" -> NotifyDueItemsRoutes(cfg, restApp.backend, token),
"usertask/scanmailbox" -> ScanMailboxRoutes(restApp.backend, token),
"calevent/check" -> CalEventCheckRoutes(),
"fts" -> FullTextIndexRoutes.secured(cfg, restApp.backend, token),
"folder" -> FolderRoutes(restApp.backend, token),
"customfield" -> CustomFieldRoutes(restApp.backend, token),
"clientSettings" -> ClientSettingsRoutes(restApp.backend, token)
"fts" -> FullTextIndexRoutes.secured(cfg, restApp.backend, token),
"folder" -> FolderRoutes(restApp.backend, token),
"customfield" -> CustomFieldRoutes(restApp.backend, token),
"clientSettings" -> ClientSettingsRoutes(restApp.backend, token)
)
def openRoutes[F[_]: Async](cfg: Config, restApp: RestApp[F]): HttpRoutes[F] =

View File

@ -579,7 +579,7 @@ trait Conversions {
)
def newSource[F[_]: Sync](s: Source, cid: Ident): F[RSource] =
timeId.map({ case (id, now) =>
timeId.map { case (id, now) =>
RSource(
id,
cid,
@ -593,7 +593,7 @@ trait Conversions {
s.fileFilter,
s.language
)
})
}
def changeSource[F[_]](s: Source, coll: Ident): RSource =
RSource(
@ -615,9 +615,9 @@ trait Conversions {
Equipment(re.eid, re.name, re.created, re.notes, re.use)
def newEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
timeId.map({ case (id, now) =>
timeId.map { case (id, now) =>
REquipment(id, cid, e.name.trim, now, now, e.notes, e.use)
})
}
def changeEquipment[F[_]: Sync](e: Equipment, cid: Ident): F[REquipment] =
Timestamp

View File

@ -29,7 +29,7 @@ object ClientRequestInfo {
scheme <- NonEmptyList.fromList(getProtocol(req).toList)
host <- getHostname(req)
port = xForwardedPort(req).getOrElse(serverPort)
hostPort = if (port == 80 || port == 443) host else s"${host}:${port}"
hostPort = if (port == 80 || port == 443) host else s"$host:$port"
} yield LenientUri(scheme, Some(hostPort), LenientUri.EmptyPath, None, None)
def getHostname[F[_]](req: Request[F]): Option[String] =

View File

@ -56,5 +56,5 @@ object AdminRoutes {
private def compareSecret(s1: String)(s2: String): Boolean =
s1.length > 0 && s1.length == s2.length &&
s1.zip(s2).forall({ case (a, b) => a == b })
s1.zip(s2).forall { case (a, b) => a == b }
}

View File

@ -33,7 +33,7 @@ object AttachmentMultiRoutes extends MultiIdSupport {
for {
json <- req.as[IdList]
attachments <- readIds[F](json.ids)
n <- backend.item.deleteAttachmentMultiple(attachments, user.account.collective)
n <- backend.item.deleteAttachmentMultiple(attachments, user.account.collective)
res = BasicResult(
n > 0,
if (n > 0) "Attachment(s) deleted" else "Attachment deletion failed."

View File

@ -109,16 +109,16 @@ object ItemMultiRoutes extends MultiIdSupport {
for {
json <- req.as[ItemsAndRef]
items <- readIds[F](json.items)
res <- backend.item.setFolderMultiple(items, json.ref, user.account.collective)
resp <- Ok(Conversions.basicResult(res, "Folder updated"))
res <- backend.item.setFolderMultiple(items, json.ref, user.account.collective)
resp <- Ok(Conversions.basicResult(res, "Folder updated"))
} yield resp
case req @ PUT -> Root / "direction" =>
for {
json <- req.as[ItemsAndDirection]
items <- readIds[F](json.items)
res <- backend.item.setDirection(items, json.direction, user.account.collective)
resp <- Ok(Conversions.basicResult(res, "Direction updated"))
res <- backend.item.setDirection(items, json.direction, user.account.collective)
resp <- Ok(Conversions.basicResult(res, "Direction updated"))
} yield resp
case req @ PUT -> Root / "date" =>