scalafmt 2.7.4

pull/7445/head
Thibault Duplessis 2020-10-10 11:08:23 +02:00
parent 3afe380228
commit 1d935e4c1d
23 changed files with 36 additions and 69 deletions

View File

@ -94,8 +94,7 @@ final class ForumTopic(env: Env) extends LilaController(env) with ForumControlle
}
}
/**
* Returns a list of the usernames of people participating in a forum topic conversation
/** Returns a list of the usernames of people participating in a forum topic conversation
*/
def participants(topicId: String) =
Auth { _ => _ =>

View File

@ -97,8 +97,7 @@ final class Main(
NoContent.fuccess
}
/**
* Event monitoring endpoint
/** Event monitoring endpoint
*/
def jsmon(event: String) =
Action {

View File

@ -13,8 +13,7 @@ final class AugmentedAny(private val self: Any) extends AnyVal {
final class PimpedBoolean(private val self: Boolean) extends AnyVal {
/**
* Replaces scalaz boolean ops
/** Replaces scalaz boolean ops
* so ?? works on Zero and not Monoid
*/
def ??[A](a: => A)(implicit z: Zero[A]): A = if (self) a else z.zero

View File

@ -3,13 +3,11 @@ package paginator
abstract class AdapterLike[A](implicit ec: scala.concurrent.ExecutionContext) {
/**
* Returns the total number of results.
/** Returns the total number of results.
*/
def nbResults: Fu[Int]
/**
* Returns a slice of the results.
/** Returns a slice of the results.
*
* @param offset The number of elements to skip, starting from zero
* @param length The maximum number of elements to return

View File

@ -8,49 +8,41 @@ import lila.common.config.MaxPerPage
final class Paginator[A] private[paginator] (
val currentPage: Int,
val maxPerPage: MaxPerPage,
/**
* Returns the results for the current page.
/** Returns the results for the current page.
* The result is cached.
*/
val currentPageResults: Seq[A],
/**
* Returns the number of results.
/** Returns the number of results.
* The result is cached.
*/
val nbResults: Int
) {
/**
* Returns the previous page.
/** Returns the previous page.
*/
def previousPage: Option[Int] = (currentPage > 1) option (currentPage - 1)
/**
* Returns the next page.
/** Returns the next page.
*/
def nextPage: Option[Int] =
(currentPage < nbPages && currentPageResults.nonEmpty) option (currentPage + 1)
/**
* Returns the number of pages.
/** Returns the number of pages.
*/
def nbPages: Int =
if (maxPerPage.value > 0) (nbResults + maxPerPage.value - 1) / maxPerPage.value
else 0
/**
* Returns whether we have to paginate or not.
/** Returns whether we have to paginate or not.
* This is true if the number of results is higher than the max per page.
*/
def hasToPaginate: Boolean = nbResults > maxPerPage.value
/**
* Returns whether there is previous page or not.
/** Returns whether there is previous page or not.
*/
def hasPreviousPage: Boolean = previousPage.isDefined
/**
* Returns whether there is next page or not.
/** Returns whether there is next page or not.
*/
def hasNextPage: Boolean = nextPage.isDefined

View File

@ -207,8 +207,7 @@ trait dsl {
// End ofTop Level Array Update Operators
//**********************************************************************************************//
/**
* Represents the initial state of the expression which has only the name of the field.
/** Represents the initial state of the expression which has only the name of the field.
* It does not know the value of the expression.
*/
trait ElementBuilder {
@ -235,8 +234,7 @@ trait dsl {
*/
case class SimpleExpression[V <: BSONValue](field: String, value: V) extends Expression[V]
/**
* Expressions of this type can be cascaded. Examples:
/** Expressions of this type can be cascaded. Examples:
*
* {{{
* "age" $gt 50 $lt 60

View File

@ -2,8 +2,7 @@ package lila.evalCache
import EvalCacheEntry._
/**
* selects the evals to store
/** selects the evals to store
* for a given position
*/
object EvalCacheSelector {

View File

@ -6,8 +6,7 @@ import lila.notify.{ MentionedInThread, Notification }
import lila.relation.RelationApi
import lila.user.{ User, UserRepo }
/**
* Notifier to inform users if they have been mentioned in a post
/** Notifier to inform users if they have been mentioned in a post
*
* @param notifyApi Api for sending inbox messages
*/
@ -28,8 +27,7 @@ final class MentionNotifier(
}
}
/**
* Checks the database to make sure that the users mentioned exist, and removes any users that do not exist
/** Checks the database to make sure that the users mentioned exist, and removes any users that do not exist
* or block the mentioner from the returned list.
*/
private def filterValidUsers(users: Set[User.ID], mentionedBy: User.ID): Fu[List[Notification.Notifies]] = {

View File

@ -3,8 +3,7 @@ package lila.hub
import akka.actor._
import scala.concurrent.duration._
/**
* Runs the work then waits cooldown
/** Runs the work then waits cooldown
* only runs once at a time per id.
* Guarantees that work is ran as early as possible.
* Also saves work and runs it after cooldown.

View File

@ -4,8 +4,7 @@ import akka.actor._
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
/**
* Delays the work, only runs once at a time per id.
/** Delays the work, only runs once at a time per id.
* Work is ran as late as possible.
*/
final class LateMultiThrottler(

View File

@ -6,8 +6,7 @@ import play.api.mvc.Result
import play.api.mvc.Results.TooManyRequests
import scala.concurrent.duration.FiniteDuration
/**
* only allow one stream at a time per key
/** only allow one stream at a time per key
*/
final class ConcurrencyLimit[K](
name: String,

View File

@ -3,8 +3,7 @@ package lila.memo
import play.api.mvc.Result
import scala.concurrent.duration.FiniteDuration
/**
* only allow one future at a time per key
/** only allow one future at a time per key
*/
final class FutureConcurrencyLimit[K](
key: String,

View File

@ -9,8 +9,7 @@ import CacheApi._
import lila.db.BSON.BSONJodaDateTimeHandler
import lila.db.dsl._
/**
* To avoid recomputing very expensive values after deploy
/** To avoid recomputing very expensive values after deploy
*/
final class MongoCache[K, V: BSONHandler] private (
name: String,

View File

@ -2,8 +2,7 @@ package lila.memo
import scala.concurrent.duration.FiniteDuration
/**
* side effect throttler that allows X ops per Y unit of time
/** side effect throttler that allows X ops per Y unit of time
*/
final class RateLimit[K](
credits: Int,

View File

@ -8,8 +8,7 @@ import scala.util.Success
import lila.common.Uptime
/**
* A synchronous cache from asynchronous computations.
/** A synchronous cache from asynchronous computations.
* It will attempt to serve cached responses synchronously.
* If none is available, it starts an async computation,
* and either waits for the result or serves a default value.

View File

@ -51,8 +51,7 @@ final class PublicChat(
}
}
/**
* Sort the tournaments by the tournaments most likely to require moderation attention
/** Sort the tournaments by the tournaments most likely to require moderation attention
*/
private def sortTournamentsByRelevance(tournaments: List[(Tournament, UserChat)]) =
tournaments.sortBy(-_._1.nbPlayers)

View File

@ -87,8 +87,7 @@ final class NotifyApi(
}
}
/**
* Inserts notification into the repository.
/** Inserts notification into the repository.
*
* If the user already has an unread notification on the topic, discard it.
*

View File

@ -93,8 +93,7 @@ object TempBan {
private val baseMinutes = 10
/**
* Create a playban. First offense: 10 min.
/** Create a playban. First offense: 10 min.
* Multiplier of repeat offense after X days:
* - 0 days: 3x
* - 0 - 3 days: linear scale from 3x to 1x

View File

@ -91,9 +91,9 @@ final class Env(
lazy val roundSocket: RoundSocket = wire[RoundSocket]
private def resignAllGamesOf(userId: User.ID) =
gameRepo allPlaying userId foreach {
_ foreach { pov => tellRound(pov.gameId, Resign(pov.playerId)) }
}
gameRepo allPlaying userId foreach {
_ foreach { pov => tellRound(pov.gameId, Resign(pov.playerId)) }
}
Bus.subscribeFuns(
"accountClose" -> { case lila.hub.actorApi.security.CloseAccount(userId) =>

View File

@ -6,8 +6,7 @@ import scala.concurrent.duration._
import lila.common.EmailAddress
import lila.user.{ User, UserRepo }
/**
* Validate and normalize emails
/** Validate and normalize emails
*/
final class EmailAddressValidator(
userRepo: UserRepo,
@ -22,8 +21,7 @@ final class EmailAddressValidator(
def validate(email: EmailAddress): Option[EmailAddressValidator.Acceptable] =
isAcceptable(email) option EmailAddressValidator.Acceptable(email)
/**
* Returns true if an E-mail address is taken by another user.
/** Returns true if an E-mail address is taken by another user.
* @param email The E-mail address to be checked
* @param forUser Optionally, the user the E-mail address field is to be assigned to.
* If they already have it assigned, returns false.

View File

@ -1,7 +1,6 @@
package lila.shutup
/**
* - words are automatically pluralized. "tit" will also match "tits"
/** - words are automatically pluralized. "tit" will also match "tits"
* - words are automatically leetified. "tit" will also match "t1t", "t-i-t", and more.
* - words do not partial match. "anal" will NOT match "analysis".
*/

View File

@ -8,8 +8,7 @@ import com.roundeights.hasher.Implicits._
import lila.common.config.Secret
/**
* Encryption for bcrypt hashes.
/** Encryption for bcrypt hashes.
*
* CTS reveals input length, which is fine for
* this application.

View File

@ -313,8 +313,7 @@ final class UserRepo(val coll: Coll)(implicit ec: scala.concurrent.ExecutionCont
def nameExists(username: String): Fu[Boolean] = idExists(normalize(username))
def idExists(id: String): Fu[Boolean] = coll exists $id(id)
/**
* Filters out invalid usernames and returns the IDs for those usernames
/** Filters out invalid usernames and returns the IDs for those usernames
*
* @param usernames Usernames to filter out the non-existent usernames from, and return the IDs for
* @return A list of IDs for the usernames that were given that were valid