diff --git a/app/views/coach/widget.scala b/app/views/coach/widget.scala index 8b95ae3966..088b7b7c31 100644 --- a/app/views/coach/widget.scala +++ b/app/views/coach/widget.scala @@ -48,9 +48,12 @@ object widget { pic(c, if (link) 300 else 350), div(cls := "overview")( (if (link) h2 else h1)(cls := "coach-name")(titleName(c)), - c.coach.profile.headline.map { h => - p(cls := s"headline ${if (h.length < 60) "small" else if (h.length < 120) "medium" else "large"}")(h) - }, + c.coach.profile.headline + .map { h => + p( + cls := s"headline ${if (h.length < 60) "small" else if (h.length < 120) "medium" else "large"}" + )(h) + }, table( tbody( tr( diff --git a/app/views/game/side.scala b/app/views/game/side.scala index a8a7cd94dc..8c914d51b4 100644 --- a/app/views/game/side.scala +++ b/app/views/game/side.scala @@ -94,7 +94,9 @@ object side { div(cls := s"player color-icon is ${p.color.name} text")( playerLink(p, withOnline = false, withDiff = true, withBerserk = true) ), - tour.flatMap(_.teamVs).map(_.teams(p.color)) map { teamLink(_, withIcon = false)(cls := "team") } + tour.flatMap(_.teamVs).map(_.teams(p.color)) map { + teamLink(_, withIcon = false)(cls := "team") + } ) } ) diff --git a/app/views/round/bits.scala b/app/views/round/bits.scala index 10740a0c7d..fded8b080e 100644 --- a/app/views/round/bits.scala +++ b/app/views/round/bits.scala @@ -103,18 +103,20 @@ object bits { div(cls := "now-playing")( playing.partition(_.isMyTurn) pipe { case (myTurn, otherTurn) => - (myTurn ++ otherTurn.take(6 - myTurn.size)) take 9 map { pov => - a(href := routes.Round.player(pov.fullId), cls := pov.isMyTurn.option("my_turn"))( - gameFen(pov, withLink = false, withTitle = false, withLive = false), - span(cls := "meta")( - playerText(pov.opponent, withRating = false), - span(cls := "indicator")( - if (pov.isMyTurn) - pov.remainingSeconds.fold[Frag](trans.yourTurn())(secondsFromNow(_, alwaysRelative = true)) - else nbsp + (myTurn ++ otherTurn.take(6 - myTurn.size)) take 9 map { + pov => + a(href := routes.Round.player(pov.fullId), cls := pov.isMyTurn.option("my_turn"))( + gameFen(pov, withLink = false, withTitle = false, withLive = false), + span(cls := "meta")( + playerText(pov.opponent, withRating = false), + span(cls := "indicator")( + if (pov.isMyTurn) + pov.remainingSeconds + .fold[Frag](trans.yourTurn())(secondsFromNow(_, alwaysRelative = true)) + else nbsp + ) ) ) - ) } } ) diff --git a/app/views/streamer/header.scala b/app/views/streamer/header.scala index 2e9c81f70c..4a5289351a 100644 --- a/app/views/streamer/header.scala +++ b/app/views/streamer/header.scala @@ -18,7 +18,9 @@ object header { s.streamer.name ), s.streamer.headline.map(_.value).map { d => - p(cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}")(d) + p(cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}")( + d + ) }, div(cls := "services")( s.streamer.twitch.map { twitch => diff --git a/app/views/streamer/index.scala b/app/views/streamer/index.scala index 0689cd43d6..3077992a35 100644 --- a/app/views/streamer/index.scala +++ b/app/views/streamer/index.scala @@ -34,7 +34,9 @@ object index { div(cls := "overview")( h1(dataIcon := "")(titleTag(s.user.title), stringValueFrag(s.streamer.name)), s.streamer.headline.map(_.value).map { d => - p(cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}")(d) + p( + cls := s"headline ${if (d.length < 60) "small" else if (d.length < 120) "medium" else "large"}" + )(d) }, div(cls := "services")( s.streamer.twitch.map { twitch => diff --git a/modules/appeal/src/main/BsonHandlers.scala b/modules/appeal/src/main/BsonHandlers.scala index fdc4665166..07b59cf6cf 100644 --- a/modules/appeal/src/main/BsonHandlers.scala +++ b/modules/appeal/src/main/BsonHandlers.scala @@ -15,6 +15,6 @@ private[appeal] object BsonHandlers { s => BSONString(s.key) ) - implicit val appealMsgHandler = Macros.handler[AppealMsg] - implicit val appealHandler = Macros.handler[Appeal] + implicit val appealMsgHandler = Macros.handler[AppealMsg] + implicit val appealHandler = Macros.handler[Appeal] } diff --git a/modules/appeal/src/main/Env.scala b/modules/appeal/src/main/Env.scala index 2c8c421b6e..a3350ed6ad 100644 --- a/modules/appeal/src/main/Env.scala +++ b/modules/appeal/src/main/Env.scala @@ -7,7 +7,7 @@ import lila.common.config._ @Module final class Env( db: lila.db.Db, - userRepo: lila.user.UserRepo, + userRepo: lila.user.UserRepo )(implicit ec: scala.concurrent.ExecutionContext) { private val coll = db(CollName("appeal")) diff --git a/modules/db/src/main/CollExt.scala b/modules/db/src/main/CollExt.scala index faa70ec7bd..d31104d104 100644 --- a/modules/db/src/main/CollExt.scala +++ b/modules/db/src/main/CollExt.scala @@ -179,13 +179,17 @@ trait CollExt { self: dsl with QueryBuilderExt => coll.update.one(selector, $set(field -> value)) def updateFieldUnchecked[V: BSONWriter](selector: Bdoc, field: String, value: V): Unit = - coll.update(ordered = false, writeConcern = WriteConcern.Unacknowledged).one(selector, $set(field -> value)) + coll + .update(ordered = false, writeConcern = WriteConcern.Unacknowledged) + .one(selector, $set(field -> value)) def incField(selector: Bdoc, field: String, value: Int = 1) = coll.update.one(selector, $inc(field -> value)) def incFieldUnchecked(selector: Bdoc, field: String, value: Int = 1): Unit = - coll.update(ordered = false, writeConcern = WriteConcern.Unacknowledged).one(selector, $inc(field -> value)) + coll + .update(ordered = false, writeConcern = WriteConcern.Unacknowledged) + .one(selector, $inc(field -> value)) def unsetField(selector: Bdoc, field: String, multi: Boolean = false) = coll.update.one(selector, $unset(field), multi = multi) diff --git a/modules/evalCache/src/main/EvalCacheSelector.scala b/modules/evalCache/src/main/EvalCacheSelector.scala index 35ff289852..e8158433a2 100644 --- a/modules/evalCache/src/main/EvalCacheSelector.scala +++ b/modules/evalCache/src/main/EvalCacheSelector.scala @@ -21,7 +21,8 @@ object EvalCacheSelector { .sortBy(-_._1) .map(_._2) // then sort each group's evals, and keep only the best eval in each group - .map(_ sortBy ranking).flatMap(_.lastOption) + .map(_ sortBy ranking) + .flatMap(_.lastOption) // now remove obsolete evals .foldLeft(Nil: Evals) { case (acc, e) if acc.exists { makesObsolete(_, e) } => acc diff --git a/modules/fishnet/src/main/Analyser.scala b/modules/fishnet/src/main/Analyser.scala index 61e0d08143..c4fe8b0983 100644 --- a/modules/fishnet/src/main/Analyser.scala +++ b/modules/fishnet/src/main/Analyser.scala @@ -62,7 +62,8 @@ final class Analyser( case true => fuFalse case _ => { import req._ - val sender = Work.Sender(req.userId.some, none, mod = false, system = lila.user.User isOfficial req.userId) + val sender = + Work.Sender(req.userId.some, none, mod = false, system = lila.user.User isOfficial req.userId) limiter(sender, ignoreConcurrentCheck = true) flatMap { accepted => if (!accepted) logger.info(s"Study request declined: ${req.studyId}/${req.chapterId} by $sender") accepted ?? { diff --git a/modules/gameSearch/src/main/Query.scala b/modules/gameSearch/src/main/Query.scala index e071754ac7..ab6272056d 100644 --- a/modules/gameSearch/src/main/Query.scala +++ b/modules/gameSearch/src/main/Query.scala @@ -132,11 +132,11 @@ object Query { options(1 to 5, "y", "%d year{s} ago") val statuses = Status.finishedNotCheated.flatMap { - case s if s.is(_.Timeout) => none - case s if s.is(_.NoStart) => none + case s if s.is(_.Timeout) => none + case s if s.is(_.NoStart) => none case s if s.is(_.UnknownFinish) => none - case s if s.is(_.Outoftime) => Some(s.id -> "Clock Flag") - case s if s.is(_.VariantEnd) => Some(s.id -> "Variant End") - case s => Some(s.id -> s.toString) + case s if s.is(_.Outoftime) => Some(s.id -> "Clock Flag") + case s if s.is(_.VariantEnd) => Some(s.id -> "Variant End") + case s => Some(s.id -> s.toString) } } diff --git a/modules/insight/src/main/JsonQuestion.scala b/modules/insight/src/main/JsonQuestion.scala index 268a0af7fc..f34ca591ac 100644 --- a/modules/insight/src/main/JsonQuestion.scala +++ b/modules/insight/src/main/JsonQuestion.scala @@ -13,34 +13,38 @@ case class JsonQuestion( for { realMetric <- Metric.byKey get metric realFilters = - filters.flatMap { - case (filterKey, valueKeys) => { - def build[X](dimension: Dimension[X]) = - Filter[X](dimension, valueKeys.flatMap { - Dimension.valueByKey(dimension, _) - }).some + filters + .flatMap { + case (filterKey, valueKeys) => { + def build[X](dimension: Dimension[X]) = + Filter[X]( + dimension, + valueKeys.flatMap { + Dimension.valueByKey(dimension, _) + } + ).some - filterKey match { - case Period.key => build(Period) - case Perf.key => build(Perf) - case Phase.key => build(Phase) - case Result.key => build(Result) - case Termination.key => build(Termination) - case Color.key => build(Color) - case Opening.key => build(Opening) - case OpponentStrength.key => build(OpponentStrength) - case PieceRole.key => build(PieceRole) - case MovetimeRange.key => build(MovetimeRange) - case MyCastling.key => build(MyCastling) - case OpCastling.key => build(OpCastling) - case QueenTrade.key => build(QueenTrade) - case MaterialRange.key => build(MaterialRange) - case Blur.key => build(Blur) - case TimeVariance.key => build(TimeVariance) - case _ => none + filterKey match { + case Period.key => build(Period) + case Perf.key => build(Perf) + case Phase.key => build(Phase) + case Result.key => build(Result) + case Termination.key => build(Termination) + case Color.key => build(Color) + case Opening.key => build(Opening) + case OpponentStrength.key => build(OpponentStrength) + case PieceRole.key => build(PieceRole) + case MovetimeRange.key => build(MovetimeRange) + case MyCastling.key => build(MyCastling) + case OpCastling.key => build(OpCastling) + case QueenTrade.key => build(QueenTrade) + case MaterialRange.key => build(MaterialRange) + case Blur.key => build(Blur) + case TimeVariance.key => build(TimeVariance) + case _ => none + } } } - } .filterNot(_.isEmpty) .toList question <- { diff --git a/modules/msg/src/main/MsgCompat.scala b/modules/msg/src/main/MsgCompat.scala index 98d23f1c67..e70fcd8c26 100644 --- a/modules/msg/src/main/MsgCompat.scala +++ b/modules/msg/src/main/MsgCompat.scala @@ -23,7 +23,8 @@ final class MsgCompat( def inbox(me: User, pageOpt: Option[Int]): Fu[JsObject] = { val page = pageOpt.fold(1)(_ atLeast 1 atMost 2) api.threadsOf(me) flatMap { allThreads => - val threads = allThreads.slice((page - 1) * maxPerPage.value, (page - 1) * maxPerPage.value + maxPerPage.value) + val threads = + allThreads.slice((page - 1) * maxPerPage.value, (page - 1) * maxPerPage.value + maxPerPage.value) lightUserApi.preloadMany(threads.map(_ other me)) inject PaginatorJson { Paginator diff --git a/modules/notify/src/main/JsonHandlers.scala b/modules/notify/src/main/JsonHandlers.scala index f28bf9e3ce..90e0b8e560 100644 --- a/modules/notify/src/main/JsonHandlers.scala +++ b/modules/notify/src/main/JsonHandlers.scala @@ -87,8 +87,9 @@ final class JSONHandlers(getLightUser: LightUser.GetterSync) { } implicit val andUnreadWrites: Writes[Notification.AndUnread] = Json.writes[Notification.AndUnread] - implicit val newNotificationWrites: Writes[NewNotification] = (newNotification: NewNotification) => Json.obj( - "notification" -> newNotification.notification, - "unread" -> newNotification.unreadNotifications - ) + implicit val newNotificationWrites: Writes[NewNotification] = (newNotification: NewNotification) => + Json.obj( + "notification" -> newNotification.notification, + "unread" -> newNotification.unreadNotifications + ) } diff --git a/modules/plan/src/main/StripeClient.scala b/modules/plan/src/main/StripeClient.scala index 3b2fa6940e..e0df8d7d82 100644 --- a/modules/plan/src/main/StripeClient.scala +++ b/modules/plan/src/main/StripeClient.scala @@ -185,8 +185,8 @@ final private class StripeClient( private def fixInput(in: Seq[(String, Any)]): Seq[(String, String)] = in flatMap { case (name, Some(x)) => Some(name -> x.toString) - case (_, None) => None - case (name, x) => Some(name -> x.toString) + case (_, None) => None + case (name, x) => Some(name -> x.toString) } private def listReader[A: Reads]: Reads[List[A]] = (__ \ "data").read[List[A]] diff --git a/modules/security/src/main/AutomaticEmail.scala b/modules/security/src/main/AutomaticEmail.scala index 34ca7f88a3..dc974e67b3 100644 --- a/modules/security/src/main/AutomaticEmail.scala +++ b/modules/security/src/main/AutomaticEmail.scala @@ -131,16 +131,16 @@ ${Mailgun.txt.serviceNote} } def onAppealReply(user: User): Funit = { - val body = s"""Hello, + val body = s"""Hello, Your appeal has received a response from the moderation team: ${baseUrl}/appeal $regards """ - lila.common.Bus.publish(SystemMsg(user.id, body), "msgSystemSend") - funit - } + lila.common.Bus.publish(SystemMsg(user.id, body), "msgSystemSend") + funit + } private def userLang(user: User) = user.realLang | lila.i18n.defaultLang } diff --git a/modules/security/src/main/Store.scala b/modules/security/src/main/Store.scala index 3d8b5f3f5e..225293e3e0 100644 --- a/modules/security/src/main/Store.scala +++ b/modules/security/src/main/Store.scala @@ -177,7 +177,8 @@ final class Store(val coll: Coll, cacheApi: lila.memo.CacheApi, localIp: IpAddre val olds = sessions .groupBy(_.compositeKey) .view - .values.flatMap(_ drop 1) + .values + .flatMap(_ drop 1) .filter(_._id != keepSessionId) .map(_._id) coll.delete.one($inIds(olds)).void diff --git a/modules/security/src/main/Tor.scala b/modules/security/src/main/Tor.scala index 9591c10921..7b2d435f72 100644 --- a/modules/security/src/main/Tor.scala +++ b/modules/security/src/main/Tor.scala @@ -4,7 +4,9 @@ import lila.common.IpAddress import play.api.libs.ws.StandaloneWSClient -final class Tor(ws: StandaloneWSClient, config: SecurityConfig.Tor)(implicit ec: scala.concurrent.ExecutionContext) { +final class Tor(ws: StandaloneWSClient, config: SecurityConfig.Tor)(implicit + ec: scala.concurrent.ExecutionContext +) { private var ips = Set.empty[IpAddress] diff --git a/modules/socket/src/main/RemoteSocket.scala b/modules/socket/src/main/RemoteSocket.scala index 4019a23bf2..76cb8a5af9 100644 --- a/modules/socket/src/main/RemoteSocket.scala +++ b/modules/socket/src/main/RemoteSocket.scala @@ -130,8 +130,8 @@ final class RemoteSocket( } }) val subPromise = Promise[Unit]() - conn.async.subscribe(channel).thenRun { - () => subPromise.success(()) + conn.async.subscribe(channel).thenRun { () => + subPromise.success(()) } subPromise.future } diff --git a/modules/streamer/src/main/Env.scala b/modules/streamer/src/main/Env.scala index de8d43e4a1..6169da87fd 100644 --- a/modules/streamer/src/main/Env.scala +++ b/modules/streamer/src/main/Env.scala @@ -46,7 +46,8 @@ final class Env( settingStore[UserIds]( "streamerAlwaysFeatured", default = UserIds(Nil), - text = "Twitch streamers who get featured without the keyword - lichess usernames separated by a comma".some + text = + "Twitch streamers who get featured without the keyword - lichess usernames separated by a comma".some ) } diff --git a/modules/study/src/main/ChapterMaker.scala b/modules/study/src/main/ChapterMaker.scala index a701e6818f..eaf24086c9 100644 --- a/modules/study/src/main/ChapterMaker.scala +++ b/modules/study/src/main/ChapterMaker.scala @@ -172,8 +172,8 @@ final private class ChapterMaker( str match { case s if s.length == Game.gameIdSize => gameRepo game s case s if s.length == Game.fullIdSize => gameRepo game Game.takeGameId(s) - case UrlRegex(id) => parseGame(id) - case _ => fuccess(none) + case UrlRegex(id) => parseGame(id) + case _ => fuccess(none) } } diff --git a/modules/study/src/main/StudyTopic.scala b/modules/study/src/main/StudyTopic.scala index 5cb22f8f46..b164420e6f 100644 --- a/modules/study/src/main/StudyTopic.scala +++ b/modules/study/src/main/StudyTopic.scala @@ -19,7 +19,7 @@ object StudyTopic { def fromStr(str: String): Option[StudyTopic] = str.trim match { case s if s.length >= minLength && s.length <= maxLength => StudyTopic(s).some - case _ => none + case _ => none } implicit val topicIso = lila.common.Iso.string[StudyTopic](StudyTopic.apply, _.value)