From 30e23a75a84055ad99c490527ff01cce75070583 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sun, 16 Aug 2020 14:48:46 +0200 Subject: [PATCH] remove superfluous blocks --- app/AppLoader.scala | 2 +- app/controllers/Account.scala | 3 +-- app/controllers/Auth.scala | 27 +++++++------------ app/controllers/Main.scala | 2 +- app/controllers/Mod.scala | 2 +- app/controllers/Round.scala | 3 +-- app/controllers/Streamer.scala | 2 +- app/templating/GameHelper.scala | 3 +-- app/templating/SetupHelper.scala | 2 +- app/views/base/layout.scala | 2 +- app/views/mod/inquiry.scala | 2 +- app/views/setup/bits.scala | 2 +- app/views/study/show.scala | 2 +- app/views/tournament/shields.scala | 3 +-- app/views/userTournament/chart.scala | 3 +-- app/views/video/bits.scala | 2 +- modules/bot/src/main/GameStateStream.scala | 2 +- modules/chat/src/main/ChatTimeout.scala | 2 +- modules/clas/src/main/Student.scala | 2 +- modules/common/src/main/String.scala | 3 +-- modules/common/src/main/WMMatching.scala | 15 ++++------- modules/common/src/main/base/RawHtml.scala | 4 +-- modules/common/src/main/model.scala | 2 +- modules/evalCache/src/main/BSONHandlers.scala | 6 ++--- modules/fishnet/src/main/Analyser.scala | 3 +-- .../fishnet/src/main/AnalysisBuilder.scala | 3 +-- modules/game/src/main/BinaryFormat.scala | 3 +-- modules/game/src/main/GifExport.scala | 8 +++--- modules/lobby/src/main/HookRepo.scala | 2 +- modules/mod/src/main/Boosting.scala | 3 +-- modules/mod/src/main/Impersonate.scala | 2 +- modules/mod/src/main/ModApi.scala | 3 +-- modules/msg/src/main/MsgSecurity.scala | 2 +- modules/plan/src/main/Expiration.scala | 2 +- modules/plan/src/main/PlanApi.scala | 2 +- modules/plan/src/main/StripeClient.scala | 3 +-- modules/pool/src/main/PoolActor.scala | 3 +-- modules/push/src/main/FirebasePush.scala | 2 +- modules/puzzle/src/main/PuzzleApi.scala | 2 +- modules/relay/src/main/RelayFetch.scala | 2 +- modules/round/src/main/Finisher.scala | 3 +-- modules/round/src/main/Player.scala | 2 +- modules/round/src/main/SelfReport.scala | 2 +- .../security/src/main/AutomaticEmail.scala | 4 +-- .../src/main/EmailAddressValidator.scala | 2 +- .../security/src/main/GarbageCollector.scala | 2 +- modules/security/src/main/Signup.scala | 2 +- modules/study/src/main/PgnDump.scala | 4 +-- modules/swiss/src/main/SwissTrf.scala | 4 +-- modules/user/src/main/RankingApi.scala | 2 +- 50 files changed, 71 insertions(+), 99 deletions(-) diff --git a/app/AppLoader.scala b/app/AppLoader.scala index e72abb3f410b0..c8f537947ec94 100644 --- a/app/AppLoader.scala +++ b/app/AppLoader.scala @@ -26,7 +26,7 @@ final class LilaComponents(ctx: ApplicationLoader.Context) extends BuiltInCompon val mem = Runtime.getRuntime().maxMemory() / 1024 / 1024 val appVersionCommit = ~configuration.getOptional[String]("app.version.commit") val appVersionDate = ~configuration.getOptional[String]("app.version.date") - s"lila ${ctx.environment.mode} $appVersionCommit $appVersionDate / java ${java}, memory: ${mem}MB" + s"lila ${ctx.environment.mode} $appVersionCommit $appVersionDate / java $java, memory: ${mem}MB" } import _root_.controllers._ diff --git a/app/controllers/Account.scala b/app/controllers/Account.scala index 823507886d3c1..d058478dd0ebe 100644 --- a/app/controllers/Account.scala +++ b/app/controllers/Account.scala @@ -413,10 +413,9 @@ final class Account( def reopenLogin(token: String) = Open { implicit ctx => env.security.reopen confirm token flatMap { - case None => { + case None => lila.mon.user.auth.reopenConfirm("token_fail").increment() notFound - } case Some(user) => env.report.api.reopenReports(lila.report.Suspect(user)) >> auth.authenticateUser(user) >>- diff --git a/app/controllers/Auth.scala b/app/controllers/Auth.scala index 41b4c4f02f1ee..5ca65202db445 100644 --- a/app/controllers/Auth.scala +++ b/app/controllers/Auth.scala @@ -337,16 +337,14 @@ final class Auth( env.security.recaptcha.verify(~data.recaptchaResponse, req) flatMap { _ ?? env.user.repo.enabledWithEmail(data.realEmail.normalize) } flatMap { - case Some((user, storedEmail)) => { + case Some((user, storedEmail)) => lila.mon.user.auth.passwordResetRequest("success").increment() env.security.passwordReset.send(user, storedEmail) inject Redirect( routes.Auth.passwordResetSent(storedEmail.conceal) ) - } - case _ => { + case _ => lila.mon.user.auth.passwordResetRequest("noEmail").increment() BadRequest(renderPasswordReset(none, fail = true)).fuccess - } } ) } @@ -361,25 +359,22 @@ final class Auth( def passwordResetConfirm(token: String) = Open { implicit ctx => env.security.passwordReset confirm token flatMap { - case None => { + case None => lila.mon.user.auth.passwordResetConfirm("tokenFail").increment() notFound - } - case Some(user) => { + case Some(user) => authLog(user.username, "-", "Reset password") lila.mon.user.auth.passwordResetConfirm("tokenOk").increment() fuccess(html.auth.bits.passwordResetConfirm(user, token, forms.passwdReset, none)) - } } } def passwordResetConfirmApply(token: String) = OpenBody { implicit ctx => env.security.passwordReset confirm token flatMap { - case None => { + case None => lila.mon.user.auth.passwordResetConfirm("tokenPostFail").increment() notFound - } case Some(user) => implicit val req = ctx.body FormFuResult(forms.passwdReset) { err => @@ -421,18 +416,16 @@ final class Auth( env.security.recaptcha.verify(~data.recaptchaResponse, req) flatMap { _ ?? env.user.repo.enabledWithEmail(data.realEmail.normalize) } flatMap { - case Some((user, storedEmail)) => { + case Some((user, storedEmail)) => MagicLinkRateLimit(user, storedEmail, ctx.req) { lila.mon.user.auth.magicLinkRequest("success").increment() env.security.magicLink.send(user, storedEmail) inject Redirect( routes.Auth.magicLinkSent(storedEmail.value) ) }(rateLimitedFu) - } - case _ => { + case _ => lila.mon.user.auth.magicLinkRequest("no_email").increment() BadRequest(renderMagicLink(none, fail = true)).fuccess - } } ) } @@ -447,15 +440,13 @@ final class Auth( def magicLinkLogin(token: String) = Open { implicit ctx => env.security.magicLink confirm token flatMap { - case None => { + case None => lila.mon.user.auth.magicLinkConfirm("token_fail").increment() notFound - } - case Some(user) => { + case Some(user) => authLog(user.username, "-", "Magic link") authenticateUser(user) >>- lila.mon.user.auth.magicLinkConfirm("success").increment() - } } } diff --git a/app/controllers/Main.scala b/app/controllers/Main.scala index 229605f76ad45..53609be0711ed 100644 --- a/app/controllers/Main.scala +++ b/app/controllers/Main.scala @@ -163,7 +163,7 @@ Allow: / "icons" -> List(32, 64, 128, 192, 256, 512, 1024).map { size => Json.obj( "src" -> s"//${env.net.assetDomain.value}/assets/logo/lichess-favicon-$size.png", - "sizes" -> s"${size}x${size}", + "sizes" -> s"${size}x$size", "type" -> "image/png" ) }, diff --git a/app/controllers/Mod.scala b/app/controllers/Mod.scala index 67a77cc6c5a91..44fca07b58db9 100644 --- a/app/controllers/Mod.scala +++ b/app/controllers/Mod.scala @@ -191,7 +191,7 @@ final class Mod( err => BadRequest(err.toString).fuccess, rawEmail => { val email = env.security.emailAddressValidator - .validate(EmailAddress(rawEmail)) err s"Invalid email ${rawEmail}" + .validate(EmailAddress(rawEmail)) err s"Invalid email $rawEmail" modApi.setEmail(me.id, user.id, email.acceptable) inject redirect(user.username, mod = true) } ) diff --git a/app/controllers/Round.scala b/app/controllers/Round.scala index 5c797474a6c4a..f992851311f9e 100644 --- a/app/controllers/Round.scala +++ b/app/controllers/Round.scala @@ -140,9 +140,8 @@ final class Round( case _ => Redirect(routes.Round.watcher(gameId, "white")).fuccess } - case None => { + case None => watch(pov) - } } case None => challengeC showId gameId } diff --git a/app/controllers/Streamer.scala b/app/controllers/Streamer.scala index c68d54108c6d5..b1e7dc7822eda 100644 --- a/app/controllers/Streamer.scala +++ b/app/controllers/Streamer.scala @@ -112,7 +112,7 @@ final class Streamer( } else { val next = if (sws.streamer is me) "" else s"?u=${sws.user.id}" - Redirect(s"${routes.Streamer.edit().url}${next}").fuccess + Redirect(s"${routes.Streamer.edit().url}$next").fuccess } } ) diff --git a/app/templating/GameHelper.scala b/app/templating/GameHelper.scala index 4235d12420fce..02fc88ae4f04a 100644 --- a/app/templating/GameHelper.scala +++ b/app/templating/GameHelper.scala @@ -194,10 +194,9 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel } case S.Draw => trans.draw.txt() case S.Outoftime => trans.timeOut.txt() - case S.NoStart => { + case S.NoStart => val color = game.loser.fold(Color.white)(_.color).name.capitalize s"$color didn't move" - } case S.Cheat => "Cheat detected" case S.VariantEnd => game.variant match { diff --git a/app/templating/SetupHelper.scala b/app/templating/SetupHelper.scala index 9250b0782ab10..f07dd4f50b11b 100644 --- a/app/templating/SetupHelper.scala +++ b/app/templating/SetupHelper.scala @@ -67,7 +67,7 @@ trait SetupHelper { self: I18nHelper => val corresDaysChoices: List[SelectChoice] = ("1", "One day", none) :: List(2, 3, 5, 7, 10, 14).map { d => - (d.toString, s"${d} days", none) + (d.toString, s"$d days", none) } def translatedTimeModeChoices(implicit lang: Lang) = diff --git a/app/views/base/layout.scala b/app/views/base/layout.scala index a247db0b23410..cedaf797d4859 100644 --- a/app/views/base/layout.scala +++ b/app/views/base/layout.scala @@ -64,7 +64,7 @@ object layout { .map { px => s"""""" + )}" sizes="${px}x$px">""" } .mkString( "", diff --git a/app/views/mod/inquiry.scala b/app/views/mod/inquiry.scala index 72c0d16e05270..105b50d1eac2a 100644 --- a/app/views/mod/inquiry.scala +++ b/app/views/mod/inquiry.scala @@ -126,7 +126,7 @@ object inquiry { div(cls := "links")( in.report.boostWith .map { userId => - a(href := s"${routes.User.games(in.user.id, "search")}?players.b=${userId}")("View", br, "Games") + a(href := s"${routes.User.games(in.user.id, "search")}?players.b=$userId")("View", br, "Games") } .getOrElse { in.report.bestAtomByHuman.map { atom => diff --git a/app/views/setup/bits.scala b/app/views/setup/bits.scala index a85abd0837354..e66e50d606c38 100644 --- a/app/views/setup/bits.scala +++ b/app/views/setup/bits.scala @@ -75,7 +75,7 @@ private object bits { div( input( `type` := "radio", - id := s"$prefix${field.id}_${key}", + id := s"$prefix${field.id}_$key", st.name := field.name, value := key, field.value.has(key) option checked diff --git a/app/views/study/show.scala b/app/views/study/show.scala index 718bbde20de93..da71b57e4754a 100644 --- a/app/views/study/show.scala +++ b/app/views/study/show.scala @@ -70,5 +70,5 @@ object show { ) ) - def socketUrl(id: String) = s"/study/$id/socket/v${apiVersion}" + def socketUrl(id: String) = s"/study/$id/socket/v$apiVersion" } diff --git a/app/views/tournament/shields.scala b/app/views/tournament/shields.scala index 0f89dea15f5d7..4a7d9b84f2c22 100644 --- a/app/views/tournament/shields.scala +++ b/app/views/tournament/shields.scala @@ -23,7 +23,7 @@ object shields { h1("Tournament shields"), div(cls := "tournament-shields")( history.sorted.map { - case (categ, awards) => { + case (categ, awards) => section( h2( a(href := routes.Tournament.categShields(categ.key))( @@ -38,7 +38,6 @@ object shields { ) }) ) - } } ) ) diff --git a/app/views/userTournament/chart.scala b/app/views/userTournament/chart.scala index e576dac46b2b2..adf10add9dc9b 100644 --- a/app/views/userTournament/chart.scala +++ b/app/views/userTournament/chart.scala @@ -39,7 +39,7 @@ object chart { ), tbody( data.perfResults.map { - case (pt, res) => { + case (pt, res) => tr( th(iconTag(pt.iconChar, pt.trans)), td(res.nb.localize), @@ -47,7 +47,6 @@ object chart { td(res.points.sum.localize), td(res.rankPercentMedian, "%") ) - } }, tr( th("Total"), diff --git a/app/views/video/bits.scala b/app/views/video/bits.scala index c8caa21452156..460a18f578069 100644 --- a/app/views/video/bits.scala +++ b/app/views/video/bits.scala @@ -50,7 +50,7 @@ object bits { videos.currentPageResults.map { card(_, control) }, videos.nextPage.map { next => div(cls := "pager none")( - a(rel := "next", href := s"${routes.Video.author(name)}?${control.queryString}&page=${next}")( + a(rel := "next", href := s"${routes.Video.author(name)}?${control.queryString}&page=$next")( "Next" ) ) diff --git a/modules/bot/src/main/GameStateStream.scala b/modules/bot/src/main/GameStateStream.scala index 9a7f177dc8ebb..edead643c7a09 100644 --- a/modules/bot/src/main/GameStateStream.scala +++ b/modules/bot/src/main/GameStateStream.scala @@ -64,7 +64,7 @@ final class GameStateStream( private val classifiers = List( MoveGameEvent makeChan id, - s"boardDrawOffer:${id}", + s"boardDrawOffer:$id", "finishGame", "abortGame", uniqChan(init.game pov as), diff --git a/modules/chat/src/main/ChatTimeout.scala b/modules/chat/src/main/ChatTimeout.scala index c90e0ee023c82..eac9da6c424b8 100644 --- a/modules/chat/src/main/ChatTimeout.scala +++ b/modules/chat/src/main/ChatTimeout.scala @@ -77,7 +77,7 @@ object ChatTimeout { def apply(key: String) = all.find(_.key == key) } implicit val ReasonBSONHandler: BSONHandler[Reason] = tryHandler[Reason]( - { case BSONString(value) => Reason(value) toTry s"Invalid reason ${value}" }, + { case BSONString(value) => Reason(value) toTry s"Invalid reason $value" }, x => BSONString(x.key) ) diff --git a/modules/clas/src/main/Student.scala b/modules/clas/src/main/Student.scala index 02f2a846de606..4a40ee091a04c 100644 --- a/modules/clas/src/main/Student.scala +++ b/modules/clas/src/main/Student.scala @@ -26,7 +26,7 @@ case class Student( object Student { - def id(userId: User.ID, clasId: Clas.Id) = Id(s"${userId}:${clasId}") + def id(userId: User.ID, clasId: Clas.Id) = Id(s"$userId:$clasId") def make(user: User, clas: Clas, teacherId: User.ID, realName: String, managed: Boolean) = Student( diff --git a/modules/common/src/main/String.scala b/modules/common/src/main/String.scala index ef28d0e330afa..9ae7438e4b38b 100644 --- a/modules/common/src/main/String.scala +++ b/modules/common/src/main/String.scala @@ -107,13 +107,12 @@ object String { case JsNumber(n) => n.toString case JsBoolean(b) => if (b) "true" else "false" case JsArray(items) => items.map(safeJsonValue).mkString("[", ",", "]") - case JsObject(fields) => { + case JsObject(fields) => fields .map { case (k, v) => s"${safeJsonString(k)}:${safeJsonValue(v)}" } .mkString("{", ",", "}") - } } } } diff --git a/modules/common/src/main/WMMatching.scala b/modules/common/src/main/WMMatching.scala index a21c81a963832..11ef5c4f2415c 100644 --- a/modules/common/src/main/WMMatching.scala +++ b/modules/common/src/main/WMMatching.scala @@ -744,14 +744,12 @@ object WMMatching { for (v <- vertices) { label(inblossom(v)) match { case 0 => () - case 1 => { + case 1 => //S-vertex: 2*u = 2*u - 2*delta dualvar(v) -= dt.delta - } - case 2 => { + case 2 => //T-vertex: 2*u = 2*u + 2*delta dualvar(v) += dt.delta - } } } @@ -768,24 +766,21 @@ object WMMatching { // Take action at the point where minimum delta occurred. dt.tp match { case 0 => false - case 1 => { + case 1 => // Use the least-slack edge to continue the search. allowedge(dt.extra) = true val kk = 2 * dt.extra val ei = endpoint(kk) queue ::= (if (label(inblossom(ei)) == 0) endpoint(kk + 1) else ei) true - } - case 2 => { + case 2 => // Use the least-slack edge to continue the search. allowedge(dt.extra) = true queue ::= endpoint(2 * dt.extra) true - } - case 3 => { + case 3 => expandBlossom(dt.extra, endstage = false) true - } } } } diff --git a/modules/common/src/main/base/RawHtml.scala b/modules/common/src/main/base/RawHtml.scala index 381161ab4b76e..086d9aef4b887 100644 --- a/modules/common/src/main/base/RawHtml.scala +++ b/modules/common/src/main/base/RawHtml.scala @@ -159,8 +159,8 @@ final object RawHtml { while ( (sArr(last): @switch) match { case '.' | ',' | '?' | '!' | ':' | ';' | '–' | '—' | '@' | '\'' => true - case '(' => { parenCnt -= 1; true } - case ')' => { parenCnt += 1; parenCnt <= 0 } + case '(' => parenCnt -= 1; true + case ')' => parenCnt += 1; parenCnt <= 0 case _ => false } ) { last -= 1 } diff --git a/modules/common/src/main/model.scala b/modules/common/src/main/model.scala index 46c7cdc669485..e3579e9a2fd9a 100644 --- a/modules/common/src/main/model.scala +++ b/modules/common/src/main/model.scala @@ -40,7 +40,7 @@ case class NormalizedEmailAddress(value: String) extends AnyVal with StringValue case class EmailAddress(value: String) extends AnyVal with StringValue { def conceal = value split '@' match { - case Array(user, domain) => s"${user take 3}*****@${domain}" + case Array(user, domain) => s"${user take 3}*****@$domain" case _ => value } def normalize = diff --git a/modules/evalCache/src/main/BSONHandlers.scala b/modules/evalCache/src/main/BSONHandlers.scala index 704eb3f661a34..1733b807e87d4 100644 --- a/modules/evalCache/src/main/BSONHandlers.scala +++ b/modules/evalCache/src/main/BSONHandlers.scala @@ -42,11 +42,11 @@ private object BSONHandlers { scoreRead(score) err s"Invalid score $score", movesRead(moves) err s"Invalid moves $moves" ) - case x => sys error s"Invalid PV $pvStr: ${x.toList} (in ${value})" + case x => sys error s"Invalid PV $pvStr: ${x.toList} (in $value)" } } }.flatMap { - _.toNel toTry s"Empty PVs ${value}" + _.toNel toTry s"Empty PVs $value" } case b => lila.db.BSON.handlerBadType[NonEmptyList[Pv]](b) } @@ -70,7 +70,7 @@ private object BSONHandlers { SmallFen raw fen ) ) - case _ => lila.db.BSON.handlerBadValue(s"Invalid evalcache id ${value}") + case _ => lila.db.BSON.handlerBadValue(s"Invalid evalcache id $value") } }, x => diff --git a/modules/fishnet/src/main/Analyser.scala b/modules/fishnet/src/main/Analyser.scala index c4fe8b0983261..da5da8c27ecff 100644 --- a/modules/fishnet/src/main/Analyser.scala +++ b/modules/fishnet/src/main/Analyser.scala @@ -60,7 +60,7 @@ final class Analyser( def study(req: lila.hub.actorApi.fishnet.StudyChapterRequest): Fu[Boolean] = analysisRepo exists req.chapterId flatMap { case true => fuFalse - case _ => { + case _ => import req._ val sender = Work.Sender(req.userId.some, none, mod = false, system = lila.user.User isOfficial req.userId) @@ -92,7 +92,6 @@ final class Analyser( } } inject accepted } - } } private def makeWork(game: Game, sender: Work.Sender): Fu[Work.Analysis] = diff --git a/modules/fishnet/src/main/AnalysisBuilder.scala b/modules/fishnet/src/main/AnalysisBuilder.scala index 168959173fd3f..c648dca47f30e 100644 --- a/modules/fishnet/src/main/AnalysisBuilder.scala +++ b/modules/fishnet/src/main/AnalysisBuilder.scala @@ -76,7 +76,7 @@ final private class AnalysisBuilder(evalCache: FishnetEvalCache)(implicit private def makeInfos(evals: List[Option[Evaluation]], moves: List[Uci], startedAtPly: Int): List[Info] = (evals filterNot (_ ?? (_.isCheckmate)) sliding 2).toList.zip(moves).zipWithIndex map { - case ((List(Some(before), Some(after)), move), index) => { + case ((List(Some(before), Some(after)), move), index) => val variation = before.cappedPv match { case first :: rest if first != move => first :: rest case _ => Nil @@ -92,7 +92,6 @@ final private class AnalysisBuilder(evalCache: FishnetEvalCache)(implicit variation = variation.map(_.uci) ) if (info.ply % 2 == 1) info.invert else info - } case ((_, _), index) => Info(index + 1 + startedAtPly, Eval.empty) } } diff --git a/modules/game/src/main/BinaryFormat.scala b/modules/game/src/main/BinaryFormat.scala index 4c652fd7be408..25639e189459f 100644 --- a/modules/game/src/main/BinaryFormat.scala +++ b/modules/game/src/main/BinaryFormat.scala @@ -111,7 +111,7 @@ object BinaryFormat { } ia match { - case Array(b1, b2, b3, b4, b5, b6, b7, b8, _*) => { + case Array(b1, b2, b3, b4, b5, b6, b7, b8, _*) => val config = Clock.Config(readClockLimit(b1), b2) val legacyWhite = Centis(readSignedInt24(b3, b4, b5)) val legacyBlack = Centis(readSignedInt24(b6, b7, b8)) @@ -130,7 +130,6 @@ object BinaryFormat { ), timer = timer ) - } case _ => sys error s"BinaryFormat.clock.read invalid bytes: ${ba.showBytes}" } } diff --git a/modules/game/src/main/GifExport.scala b/modules/game/src/main/GifExport.scala index 6dbbc061ff70a..a0e77c1f0076b 100644 --- a/modules/game/src/main/GifExport.scala +++ b/modules/game/src/main/GifExport.scala @@ -22,7 +22,7 @@ final class GifExport( def fromPov(pov: Pov, initialFen: Option[FEN]): Fu[Source[ByteString, _]] = lightUserApi preloadMany pov.game.userIds flatMap { _ => - ws.url(s"${url}/game.gif") + ws.url(s"$url/game.gif") .withMethod("POST") .addHttpHeaders("Content-Type" -> "application/json") .withBody( @@ -55,7 +55,7 @@ final class GifExport( ).flatten lightUserApi preloadMany game.userIds flatMap { _ => - ws.url(s"${url}/image.gif") + ws.url(s"$url/image.gif") .withMethod("GET") .withQueryStringParameters(query: _*) .stream() flatMap { @@ -75,12 +75,12 @@ final class GifExport( lastMove.map { "lastMove" -> _ } ).flatten - ws.url(s"${url}/image.gif") + ws.url(s"$url/image.gif") .withMethod("GET") .withQueryStringParameters(query: _*) .stream() flatMap { case res if res.status != 200 => - logger.warn(s"GifExport thumbnail ${fen} ${res.status}") + logger.warn(s"GifExport thumbnail $fen ${res.status}") fufail(res.statusText) case res => fuccess(res.bodyAsSource) } diff --git a/modules/lobby/src/main/HookRepo.scala b/modules/lobby/src/main/HookRepo.scala index 27789d354a5bd..d033881f92a5d 100644 --- a/modules/lobby/src/main/HookRepo.scala +++ b/modules/lobby/src/main/HookRepo.scala @@ -16,7 +16,7 @@ private object HookRepo { def truncateIfNeeded() = if (size >= hardLimit) { - logger.warn(s"Found ${size} hooks, cleaning up!") + logger.warn(s"Found $size hooks, cleaning up!") hooks = hooks.sortBy(-_.createdAt.getMillis).take(hardLimit * 2 / 3) logger.warn(s"Kept ${hooks.size} hooks") } diff --git a/modules/mod/src/main/Boosting.scala b/modules/mod/src/main/Boosting.scala index fbdb0a5be60bc..88f38026f67b6 100644 --- a/modules/mod/src/main/Boosting.scala +++ b/modules/mod/src/main/Boosting.scala @@ -53,7 +53,7 @@ final class BoostingApi( && game.clock.fold(false) { _.limitInMinutes >= 1 } ) { game.winnerColor match { - case Some(a) => { + case Some(a) => val result: GameResult = a match { case Color.White => GameResult(winner = whiteUser, loser = blackUser) case Color.Black => GameResult(winner = blackUser, loser = whiteUser) @@ -74,7 +74,6 @@ final class BoostingApi( ) ) } - } case None => funit } } else { diff --git a/modules/mod/src/main/Impersonate.scala b/modules/mod/src/main/Impersonate.scala index 163d420bf6976..bd30cb8c65a5b 100644 --- a/modules/mod/src/main/Impersonate.scala +++ b/modules/mod/src/main/Impersonate.scala @@ -21,7 +21,7 @@ final class ImpersonateApi(userRepo: UserRepo) { userToMod.get(user.id) ?? { modId => modToUser = modToUser - modId userToMod = userToMod - user.id - logger.info(s"${modId} stops impersonating ${user.username}") + logger.info(s"$modId stops impersonating ${user.username}") Bus.publish(Impersonate(user.id, none), "impersonate") } diff --git a/modules/mod/src/main/ModApi.scala b/modules/mod/src/main/ModApi.scala index 88567b7c6eb96..055682696248f 100644 --- a/modules/mod/src/main/ModApi.scala +++ b/modules/mod/src/main/ModApi.scala @@ -113,11 +113,10 @@ final class ModApi( def setTitle(mod: String, username: String, title: Option[Title]): Funit = withUser(username) { user => title match { - case None => { + case None => userRepo.removeTitle(user.id) >>- logApi.removeTitle(mod, user.id) >>- lightUserApi.invalidate(user.id) - } case Some(t) => Title.names.get(t) ?? { tFull => userRepo.addTitle(user.id, t) >>- diff --git a/modules/msg/src/main/MsgSecurity.scala b/modules/msg/src/main/MsgSecurity.scala index 6b20ae8629928..2c1a9a88cad00 100644 --- a/modules/msg/src/main/MsgSecurity.scala +++ b/modules/msg/src/main/MsgSecurity.scala @@ -84,7 +84,7 @@ final private class MsgSecurity( "autoFlag" ) case Spam => - logger.warn(s"PM spam from ${contacts.orig.id}: ${text}") + logger.warn(s"PM spam from ${contacts.orig.id}: $text") case _ => } } diff --git a/modules/plan/src/main/Expiration.scala b/modules/plan/src/main/Expiration.scala index 2f38a6cd78c64..01960d3182c09 100644 --- a/modules/plan/src/main/Expiration.scala +++ b/modules/plan/src/main/Expiration.scala @@ -19,7 +19,7 @@ final private class Expiration( _.map { patron => patronColl.update.one($id(patron.id), patron.removeStripe.removePayPal) >> disableUserPlanOf(patron) >>- - logger.info(s"Expired ${patron}") + logger.info(s"Expired $patron") }.sequenceFu.void } diff --git a/modules/plan/src/main/PlanApi.scala b/modules/plan/src/main/PlanApi.scala index 950d58777a318..1c0fdaf62aa2e 100644 --- a/modules/plan/src/main/PlanApi.scala +++ b/modules/plan/src/main/PlanApi.scala @@ -170,7 +170,7 @@ final class PlanApi( setDbUserPlan(user, user.plan.disable) >> patronColl.update.one($id(user.id), patron.removeStripe).void >> notifier.onExpire(user) >>- - logger.info(s"Unsubed ${user.username} ${sub}") + logger.info(s"Unsubed ${user.username} $sub") } } diff --git a/modules/plan/src/main/StripeClient.scala b/modules/plan/src/main/StripeClient.scala index e0df8d7d820ba..71fa11af6fd5e 100644 --- a/modules/plan/src/main/StripeClient.scala +++ b/modules/plan/src/main/StripeClient.scala @@ -124,10 +124,9 @@ final private class StripeClient( private def getOne[A: Reads](url: String, queryString: (String, Any)*): Fu[Option[A]] = get[A](url, queryString) dmap Some.apply recover { case _: NotFoundException => None - case e: DeletedException => { + case e: DeletedException => play.api.Logger("stripe").warn(e.getMessage) None - } } private def getList[A: Reads](url: String, queryString: (String, Any)*): Fu[List[A]] = diff --git a/modules/pool/src/main/PoolActor.scala b/modules/pool/src/main/PoolActor.scala index 85548acde4fb9..017feeed58901 100644 --- a/modules/pool/src/main/PoolActor.scala +++ b/modules/pool/src/main/PoolActor.scala @@ -64,7 +64,7 @@ final private class PoolActor( nextWave.cancel() hookThieve.candidates(config.clock) pipeTo self - case HookThieve.PoolHooks(hooks) => { + case HookThieve.PoolHooks(hooks) => monitor.withRange(monId).record(members.count(_.hasRange)) @@ -96,7 +96,6 @@ final private class PoolActor( } scheduleWave() - } case Sris(sris) => members = members.filter { m => diff --git a/modules/push/src/main/FirebasePush.scala b/modules/push/src/main/FirebasePush.scala index 3066b7f05cbbf..353c2c79e6256 100644 --- a/modules/push/src/main/FirebasePush.scala +++ b/modules/push/src/main/FirebasePush.scala @@ -70,7 +70,7 @@ final private class FirebasePush( ) flatMap { case res if res.status == 200 => funit case res if res.status == 404 => - logger.info(s"Delete missing firebase device ${device}") + logger.info(s"Delete missing firebase device $device") deviceApi delete device case res => fufail(s"[push] firebase: ${res.status}") } diff --git a/modules/puzzle/src/main/PuzzleApi.scala b/modules/puzzle/src/main/PuzzleApi.scala index 5aac4be0d1b09..b8d79fc40f786 100644 --- a/modules/puzzle/src/main/PuzzleApi.scala +++ b/modules/puzzle/src/main/PuzzleApi.scala @@ -91,7 +91,7 @@ final private[puzzle] class PuzzleApi( } def update(id: PuzzleId, user: User, v1: Option[Vote], v: Boolean): Fu[(Puzzle, Vote)] = - puzzle find id orFail s"Can't vote for non existing puzzle ${id}" flatMap { p1 => + puzzle find id orFail s"Can't vote for non existing puzzle $id" flatMap { p1 => val (p2, v2) = v1 match { case Some(from) => ( diff --git a/modules/relay/src/main/RelayFetch.scala b/modules/relay/src/main/RelayFetch.scala index 90ab063caaa6e..b1fd6efe52289 100644 --- a/modules/relay/src/main/RelayFetch.scala +++ b/modules/relay/src/main/RelayFetch.scala @@ -260,7 +260,7 @@ private object RelayFetch { secondsLeft = move.lift(1).map(_.takeWhile(_.isDigit)) flatMap (_.toIntOption) ) } mkString " " - s"${extraTags}\n\n$strMoves" + s"$extraTags\n\n$strMoves" } } implicit val gameReads = Json.reads[GameJson] diff --git a/modules/round/src/main/Finisher.scala b/modules/round/src/main/Finisher.scala index 4ac224c437df2..5113238c3b4f9 100644 --- a/modules/round/src/main/Finisher.scala +++ b/modules/round/src/main/Finisher.scala @@ -134,7 +134,7 @@ final private class Finisher( g.blackPlayer.userId ) .flatMap { - case (whiteO, blackO) => { + case (whiteO, blackO) => val finish = FinishGame(g, whiteO, blackO) updateCountAndPerfs(finish) map { ratingDiffs => message foreach { messenger.system(g, _) } @@ -144,7 +144,6 @@ final private class Finisher( } prog.events :+ lila.game.Event.EndData(g, ratingDiffs) } - } } } diff --git a/modules/round/src/main/Player.scala b/modules/round/src/main/Player.scala index ec1353d73b3ca..5107af9a7ed1f 100644 --- a/modules/round/src/main/Player.scala +++ b/modules/round/src/main/Player.scala @@ -105,7 +105,7 @@ final private class Player( } else fufail( FishnetError( - s"Not AI turn move: ${uci} id: ${game.id} playable: ${game.playable} player: ${game.player}" + s"Not AI turn move: $uci id: ${game.id} playable: ${game.playable} player: ${game.player}" ) ) diff --git a/modules/round/src/main/SelfReport.scala b/modules/round/src/main/SelfReport.scala index 9bbb5c8824d59..f8834b7044863 100644 --- a/modules/round/src/main/SelfReport.scala +++ b/modules/round/src/main/SelfReport.scala @@ -19,7 +19,7 @@ final class SelfReport( private object recent { private val cache = new lila.memo.ExpireSetMemo(10 minutes) def isNew(user: User, fullId: Game.FullId): Boolean = { - val key = s"${user.id}:${fullId}" + val key = s"${user.id}:$fullId" val res = !cache.get(key) cache.put(key) res diff --git a/modules/security/src/main/AutomaticEmail.scala b/modules/security/src/main/AutomaticEmail.scala index dc974e67b3c57..f5b92b5d573c9 100644 --- a/modules/security/src/main/AutomaticEmail.scala +++ b/modules/security/src/main/AutomaticEmail.scala @@ -50,7 +50,7 @@ ${Mailgun.txt.serviceNote} val body = s"""Hello, Thank you for confirming your $title title on Lichess. -It is now visible on your profile page: ${baseUrl}/@/${user.username}. +It is now visible on your profile page: $baseUrl/@/${user.username}. $regards """ @@ -76,7 +76,7 @@ ${Mailgun.txt.serviceNote} val body = s"""Hello, It is our pleasure to welcome you as a Lichess coach. -Your coach profile awaits you on ${baseUrl}/coach/edit. +Your coach profile awaits you on $baseUrl/coach/edit. $regards """ diff --git a/modules/security/src/main/EmailAddressValidator.scala b/modules/security/src/main/EmailAddressValidator.scala index b05f95e69f0a9..bce5ea925c43d 100644 --- a/modules/security/src/main/EmailAddressValidator.scala +++ b/modules/security/src/main/EmailAddressValidator.scala @@ -84,7 +84,7 @@ final class EmailAddressValidator( 90.millis, "dns", { logger.warn( - s"EmailAddressValidator.withAcceptableDns timeout! ${e} records should have been preloaded" + s"EmailAddressValidator.withAcceptableDns timeout! $e records should have been preloaded" ) false } diff --git a/modules/security/src/main/GarbageCollector.scala b/modules/security/src/main/GarbageCollector.scala index 7234cf590e2f1..3d1fc535848fc 100644 --- a/modules/security/src/main/GarbageCollector.scala +++ b/modules/security/src/main/GarbageCollector.scala @@ -59,7 +59,7 @@ final class GarbageCollector( ipSusp <- ipTrust.isSuspicious(ip) } yield { val printOpt = spy.prints.headOption - logger.debug(s"apply ${data.user.username} print=${printOpt}") + logger.debug(s"apply ${data.user.username} print=$printOpt") Bus.publish( lila.security.UserSignup(user, email, req, printOpt.map(_.fp.value), ipSusp), "userSignup" diff --git a/modules/security/src/main/Signup.scala b/modules/security/src/main/Signup.scala index e0e1f1c818d92..a5f0100174b3a 100644 --- a/modules/security/src/main/Signup.scala +++ b/modules/security/src/main/Signup.scala @@ -174,7 +174,7 @@ final class Signup( authLog( user.username, email.value, - s"fp: ${fingerPrint} mustConfirm: $mustConfirm fp: ${fingerPrint.??(_.value)} api: ${apiVersion.??(_.value)}" + s"fp: $fingerPrint mustConfirm: $mustConfirm fp: ${fingerPrint.??(_.value)} api: ${apiVersion.??(_.value)}" ) val ip = HTTPRequest lastRemoteAddress req ipTrust.isSuspicious(ip) foreach { susp => diff --git a/modules/study/src/main/PgnDump.scala b/modules/study/src/main/PgnDump.scala index e772f20980423..0fecfb592c6d3 100644 --- a/modules/study/src/main/PgnDump.scala +++ b/modules/study/src/main/PgnDump.scala @@ -39,7 +39,7 @@ final class PgnDump( def filename(study: Study): String = { val date = dateFormat.print(study.createdAt) fileR.replaceAllIn( - s"lichess_study_${slugify(study.name.value)}_by_${ownerName(study)}_${date}", + s"lichess_study_${slugify(study.name.value)}_by_${ownerName(study)}_$date", "" ) } @@ -47,7 +47,7 @@ final class PgnDump( def filename(study: Study, chapter: Chapter): String = { val date = dateFormat.print(chapter.createdAt) fileR.replaceAllIn( - s"lichess_study_${slugify(study.name.value)}_${slugify(chapter.name.value)}_by_${ownerName(study)}_${date}", + s"lichess_study_${slugify(study.name.value)}_${slugify(chapter.name.value)}_by_${ownerName(study)}_$date", "" ) } diff --git a/modules/swiss/src/main/SwissTrf.scala b/modules/swiss/src/main/SwissTrf.scala index 579962930d76d..e4a921df52f56 100644 --- a/modules/swiss/src/main/SwissTrf.scala +++ b/modules/swiss/src/main/SwissTrf.scala @@ -26,13 +26,13 @@ final class SwissTrf( Source( List( s"012 ${swiss.name}", - s"022 ${baseUrl}/swiss/${swiss.id}", + s"022 $baseUrl/swiss/${swiss.id}", s"032 Lichess", s"042 ${dateFormatter print swiss.startsAt}", s"052 ${swiss.finishedAt ?? dateFormatter.print}", s"062 ${swiss.nbPlayers}", s"092 Individual: Swiss-System", - s"102 ${baseUrl}/swiss", + s"102 $baseUrl/swiss", s"XXR ${swiss.settings.nbRounds}", s"XXC ${chess.Color(swiss.id.value(0).toInt % 2 == 0).name}1" ) diff --git a/modules/user/src/main/RankingApi.scala b/modules/user/src/main/RankingApi.scala index 785896df0f431..3fb991f2becb3 100644 --- a/modules/user/src/main/RankingApi.scala +++ b/modules/user/src/main/RankingApi.scala @@ -59,7 +59,7 @@ final class RankingApi( } private def makeId(userId: User.ID, perfType: PerfType) = - s"${userId}:${perfType.id}" + s"$userId:${perfType.id}" private[user] def topPerf(perfId: Perf.ID, nb: Int): Fu[List[User.LightPerf]] = PerfType.id2key(perfId) ?? { perfKey =>