Merge pull request #1081 from eikek/reformat

Update scalafmt settings
This commit is contained in:
mergify[bot] 2021-09-22 15:35:23 +00:00 committed by GitHub
commit cc5c01089a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
277 changed files with 1579 additions and 1615 deletions

View File

@ -1,6 +1,7 @@
version = "3.0.4" version = "3.0.4"
preset = defaultWithAlign preset = default
align.preset = some
maxColumn = 90 maxColumn = 90
@ -12,3 +13,10 @@ rewrite.rules = [
PreferCurlyFors PreferCurlyFors
SortModifiers SortModifiers
] ]
assumeStandardLibraryStripMargin = true
align.stripMargin = true
docstrings.style = SpaceAsterisk
docstrings.oneline = fold
docstrings.wrap = "yes"

View File

@ -14,8 +14,7 @@ private[analysis] object Tld {
def endsWithTld(str: String): Boolean = def endsWithTld(str: String): Boolean =
findTld(str).isDefined findTld(str).isDefined
/** Some selected TLDs. /** Some selected TLDs. */
*/
private[this] val known = List( private[this] val known = List(
".com", ".com",
".org", ".org",

View File

@ -8,8 +8,7 @@ package docspell.analysis.split
import fs2.Stream import fs2.Stream
/** Splits text into words. /** Splits text into words. */
*/
object TextSplitter { object TextSplitter {
private[this] val trimChars = private[this] val trimChars =
".,…_[]^!<>=&ſ/{}*?()-:#$|~`+%\\\"'; \t\r\n".toSet ".,…_[]^!<>=&ſ/{}*?()-:#$|~`+%\\\"'; \t\r\n".toSet

View File

@ -49,8 +49,7 @@ trait OFulltext[F[_]] {
def findIndexOnlySummary(account: AccountId, fts: OFulltext.FtsInput): F[SearchSummary] def findIndexOnlySummary(account: AccountId, fts: OFulltext.FtsInput): F[SearchSummary]
def findItemsSummary(q: Query, fts: OFulltext.FtsInput): F[SearchSummary] def findItemsSummary(q: Query, fts: OFulltext.FtsInput): F[SearchSummary]
/** Clears the full-text index completely and launches a task that indexes all data. /** Clears the full-text index completely and launches a task that indexes all data. */
*/
def reindexAll: F[Unit] def reindexAll: F[Unit]
/** Clears the full-text index for the given collective and starts a task indexing all /** Clears the full-text index for the given collective and starts a task indexing all

View File

@ -188,23 +188,20 @@ trait OItem[F[_]] {
notifyJoex: Boolean notifyJoex: Boolean
): F[UpdateResult] ): F[UpdateResult]
/** Submits a task that (re)generates the preview image for an attachment. /** Submits a task that (re)generates the preview image for an attachment. */
*/
def generatePreview( def generatePreview(
args: MakePreviewArgs, args: MakePreviewArgs,
account: AccountId, account: AccountId,
notifyJoex: Boolean notifyJoex: Boolean
): F[UpdateResult] ): F[UpdateResult]
/** Submits a task that (re)generates the preview images for all attachments. /** Submits a task that (re)generates the preview images for all attachments. */
*/
def generateAllPreviews( def generateAllPreviews(
storeMode: MakePreviewArgs.StoreMode, storeMode: MakePreviewArgs.StoreMode,
notifyJoex: Boolean notifyJoex: Boolean
): F[UpdateResult] ): F[UpdateResult]
/** Merges a list of items into one item. The remaining items are deleted. /** Merges a list of items into one item. The remaining items are deleted. */
*/
def merge( def merge(
logger: Logger[F], logger: Logger[F],
items: NonEmptyList[Ident], items: NonEmptyList[Ident],

View File

@ -48,8 +48,7 @@ trait OSimpleSearch[F[_]] {
): F[StringSearchResult[Items]] = ): F[StringSearchResult[Items]] =
OSimpleSearch.applySearch[F, Items](fix, q)((iq, fts) => search(settings)(iq, fts)) OSimpleSearch.applySearch[F, Items](fix, q)((iq, fts) => search(settings)(iq, fts))
/** Same as `searchByString` but returning a summary instead of the results. /** Same as `searchByString` but returning a summary instead of the results. */
*/
final def searchSummaryByString( final def searchSummaryByString(
settings: StatsSettings settings: StatsSettings
)(fix: Query.Fix, q: ItemQueryString)(implicit )(fix: Query.Fix, q: ItemQueryString)(implicit

View File

@ -29,8 +29,7 @@ trait OTag[F[_]] {
def delete(id: Ident, collective: Ident): F[AddResult] def delete(id: Ident, collective: Ident): F[AddResult]
/** Load all tags given their ids. Ids that are not available are ignored. /** Load all tags given their ids. Ids that are not available are ignored. */
*/
def loadAll(ids: List[Ident]): F[Vector[RTag]] def loadAll(ids: List[Ident]): F[Vector[RTag]]
} }

View File

@ -102,8 +102,7 @@ object OUpload {
def noSource: UploadResult = NoSource def noSource: UploadResult = NoSource
/** When adding files to an item, no item was found using the given item-id. /** When adding files to an item, no item was found using the given item-id. */
*/
case object NoItem extends UploadResult case object NoItem extends UploadResult
def noItem: UploadResult = NoItem def noItem: UploadResult = NoItem

View File

@ -19,8 +19,7 @@ import io.circe.Encoder
trait OUserTask[F[_]] { trait OUserTask[F[_]] {
/** Return the settings for all scan-mailbox tasks of the current user. /** Return the settings for all scan-mailbox tasks of the current user. */
*/
def getScanMailbox(scope: UserTaskScope): Stream[F, UserTask[ScanMailboxArgs]] def getScanMailbox(scope: UserTaskScope): Stream[F, UserTask[ScanMailboxArgs]]
/** Find a scan-mailbox task by the given id. */ /** Find a scan-mailbox task by the given id. */
@ -29,16 +28,14 @@ trait OUserTask[F[_]] {
scope: UserTaskScope scope: UserTaskScope
): OptionT[F, UserTask[ScanMailboxArgs]] ): OptionT[F, UserTask[ScanMailboxArgs]]
/** Updates the scan-mailbox tasks and notifies the joex nodes. /** Updates the scan-mailbox tasks and notifies the joex nodes. */
*/
def submitScanMailbox( def submitScanMailbox(
scope: UserTaskScope, scope: UserTaskScope,
subject: Option[String], subject: Option[String],
task: UserTask[ScanMailboxArgs] task: UserTask[ScanMailboxArgs]
): F[Unit] ): F[Unit]
/** Return the settings for all the notify-due-items task of the current user. /** Return the settings for all the notify-due-items task of the current user. */
*/
def getNotifyDueItems(scope: UserTaskScope): Stream[F, UserTask[NotifyDueItemsArgs]] def getNotifyDueItems(scope: UserTaskScope): Stream[F, UserTask[NotifyDueItemsArgs]]
/** Find a notify-due-items task by the given id. */ /** Find a notify-due-items task by the given id. */
@ -47,8 +44,7 @@ trait OUserTask[F[_]] {
scope: UserTaskScope scope: UserTaskScope
): OptionT[F, UserTask[NotifyDueItemsArgs]] ): OptionT[F, UserTask[NotifyDueItemsArgs]]
/** Updates the notify-due-items tasks and notifies the joex nodes. /** Updates the notify-due-items tasks and notifies the joex nodes. */
*/
def submitNotifyDueItems( def submitNotifyDueItems(
scope: UserTaskScope, scope: UserTaskScope,
subject: Option[String], subject: Option[String],

View File

@ -12,19 +12,15 @@ sealed trait SendResult
object SendResult { object SendResult {
/** Mail was successfully sent and stored to db. /** Mail was successfully sent and stored to db. */
*/
case class Success(id: Ident) extends SendResult case class Success(id: Ident) extends SendResult
/** There was a failure sending the mail. The mail is then not saved to db. /** There was a failure sending the mail. The mail is then not saved to db. */
*/
case class SendFailure(ex: Throwable) extends SendResult case class SendFailure(ex: Throwable) extends SendResult
/** The mail was successfully sent, but storing to db failed. /** The mail was successfully sent, but storing to db failed. */
*/
case class StoreFailure(ex: Throwable) extends SendResult case class StoreFailure(ex: Throwable) extends SendResult
/** Something could not be found required for sending (mail configs, items etc). /** Something could not be found required for sending (mail configs, items etc). */
*/
case object NotFound extends SendResult case object NotFound extends SendResult
} }

View File

@ -23,8 +23,7 @@ object CollectiveState {
/** A collective that has been explicitely closed. */ /** A collective that has been explicitely closed. */
case object Closed extends CollectiveState case object Closed extends CollectiveState
/** A collective blocked by a super user, usually some emergency action. /** A collective blocked by a super user, usually some emergency action. */
*/
case object Blocked extends CollectiveState case object Blocked extends CollectiveState
def fromString(s: String): Either[String, CollectiveState] = def fromString(s: String): Either[String, CollectiveState] =

View File

@ -20,8 +20,7 @@ object JobState {
/** Waiting for being executed. */ /** Waiting for being executed. */
case object Waiting extends JobState {} case object Waiting extends JobState {}
/** A scheduler has picked up this job and will pass it to the next free slot. /** A scheduler has picked up this job and will pass it to the next free slot. */
*/
case object Scheduled extends JobState {} case object Scheduled extends JobState {}
/** Is currently executing */ /** Is currently executing */

View File

@ -81,8 +81,7 @@ object MetaProposal {
implicit val order: Order[Candidate] = implicit val order: Order[Candidate] =
Order.by(_.ref) Order.by(_.ref)
/** This deviates from standard order to sort None at last. /** This deviates from standard order to sort None at last. */
*/
val weightOrder: Order[Option[Double]] = new Order[Option[Double]] { val weightOrder: Order[Option[Double]] = new Order[Option[Double]] {
def compare(x: Option[Double], y: Option[Double]) = def compare(x: Option[Double], y: Option[Double]) =
(x, y) match { (x, y) match {

View File

@ -15,8 +15,7 @@ import docspell.common.syntax.all._
import io.circe.{Decoder, Encoder} import io.circe.{Decoder, Encoder}
/** A MIME Type impl with just enough features for the use here. /** A MIME Type impl with just enough features for the use here. */
*/
case class MimeType(primary: String, sub: String, params: Map[String, String]) { case class MimeType(primary: String, sub: String, params: Map[String, String]) {
def withParam(name: String, value: String): MimeType = def withParam(name: String, value: String): MimeType =
copy(params = params.updated(name, value)) copy(params = params.updated(name, value))

View File

@ -8,8 +8,7 @@ package docspell.common
import scala.concurrent.ExecutionContext import scala.concurrent.ExecutionContext
/** Captures thread pools to use in an application. /** Captures thread pools to use in an application. */
*/
case class Pools( case class Pools(
connectEC: ExecutionContext, connectEC: ExecutionContext,
httpClientEC: ExecutionContext, httpClientEC: ExecutionContext,

View File

@ -14,8 +14,7 @@ import docspell.common._
object Ocr { object Ocr {
/** Extract the text of all pages in the given pdf file. /** Extract the text of all pages in the given pdf file. */
*/
def extractPdf[F[_]: Async]( def extractPdf[F[_]: Async](
pdf: Stream[F, Byte], pdf: Stream[F, Byte],
logger: Logger[F], logger: Logger[F],
@ -30,8 +29,7 @@ object Ocr {
.last .last
} }
/** Extract the text from the given image file /** Extract the text from the given image file */
*/
def extractImage[F[_]: Async]( def extractImage[F[_]: Async](
img: Stream[F, Byte], img: Stream[F, Byte],
logger: Logger[F], logger: Logger[F],
@ -139,8 +137,7 @@ object Ocr {
} }
} }
/** Run tesseract on the given image file and return the extracted text. /** Run tesseract on the given image file and return the extracted text. */
*/
private[extract] def runTesseractFile[F[_]: Async]( private[extract] def runTesseractFile[F[_]: Async](
img: Path, img: Path,
logger: Logger[F], logger: Logger[F],
@ -159,8 +156,7 @@ object Ocr {
.map(_.stdout) .map(_.stdout)
} }
/** Run tesseract on the given image file and return the extracted text. /** Run tesseract on the given image file and return the extracted text. */
*/
private[extract] def runTesseractStdin[F[_]: Async]( private[extract] def runTesseractStdin[F[_]: Async](
img: Stream[F, Byte], img: Stream[F, Byte],
logger: Logger[F], logger: Logger[F],

View File

@ -22,8 +22,7 @@ import docspell.store.records.RPerson
import io.circe.syntax._ import io.circe.syntax._
import org.log4s.getLogger import org.log4s.getLogger
/** Maintains a custom regex-ner file per collective for stanford's regexner annotator. /** Maintains a custom regex-ner file per collective for stanford's regexner annotator. */
*/
trait RegexNerFile[F[_]] { trait RegexNerFile[F[_]] {
def makeFile(collective: Ident): F[Option[Path]] def makeFile(collective: Ident): F[Option[Path]]

View File

@ -10,8 +10,7 @@ import cats.data.Kleisli
package object fts { package object fts {
/** Some work that must be done to advance the schema of the fulltext index. /** Some work that must be done to advance the schema of the fulltext index. */
*/
type FtsWork[F[_]] = Kleisli[F, FtsContext[F], Unit] type FtsWork[F[_]] = Kleisli[F, FtsContext[F], Unit]
} }

View File

@ -17,8 +17,7 @@ import docspell.joex.scheduler.{Context, Task}
import docspell.store.queries.QItem import docspell.store.queries.QItem
import docspell.store.records._ import docspell.store.records._
/** Task that creates the item. /** Task that creates the item. */
*/
object CreateItem { object CreateItem {
def apply[F[_]: Sync]: Task[F, ProcessItemArgs, ItemData] = def apply[F[_]: Sync]: Task[F, ProcessItemArgs, ItemData] =

View File

@ -14,8 +14,7 @@ import docspell.joex.scheduler.{Context, Task}
import docspell.store.AddResult import docspell.store.AddResult
import docspell.store.records._ import docspell.store.records._
/** Saves the proposals in the database /** Saves the proposals in the database */
*/
object SaveProposals { object SaveProposals {
type Args = ProcessItemArgs type Args = ProcessItemArgs

View File

@ -13,8 +13,7 @@ import cats.implicits._
import docspell.common.Logger import docspell.common.Logger
/** The code that is executed by the scheduler /** The code that is executed by the scheduler */
*/
trait Task[F[_], A, B] { trait Task[F[_], A, B] {
def run(ctx: Context[F, A]): F[B] def run(ctx: Context[F, A]): F[B]

View File

@ -51,7 +51,8 @@ class UpdateCheckTest extends FunSuite {
object UpdateCheckTest { object UpdateCheckTest {
val exampleResponsePartial = """ val exampleResponsePartial =
"""
|{ |{
| "url": "https://api.github.com/repos/eikek/docspell/releases/99899888", | "url": "https://api.github.com/repos/eikek/docspell/releases/99899888",
| "assets_url": "https://api.github.com/repos/eikek/docspell/releases/99899888/assets", | "assets_url": "https://api.github.com/repos/eikek/docspell/releases/99899888/assets",

View File

@ -14,8 +14,7 @@ import docspell.query.ItemQuery.Expr.NotExpr
import docspell.query.ItemQuery.Expr.OrExpr import docspell.query.ItemQuery.Expr.OrExpr
import docspell.query.ItemQuery._ import docspell.query.ItemQuery._
/** Currently, fulltext in a query is only supported when in "root AND" position /** Currently, fulltext in a query is only supported when in "root AND" position */
*/
object FulltextExtract { object FulltextExtract {
sealed trait Result sealed trait Result

View File

@ -73,8 +73,7 @@ object StringUtil {
(P.char('\\') ~ after).void (P.char('\\') ~ after).void
} }
/** String content without the delimiter /** String content without the delimiter */
*/
def undelimitedString(endP: P[Unit]): P[String] = def undelimitedString(endP: P[Unit]): P[String] =
escapedToken.backtrack escapedToken.backtrack
.orElse((!endP).with1 ~ P.anyChar) .orElse((!endP).with1 ~ P.anyChar)

View File

@ -16,8 +16,7 @@ import org.http4s._
import org.http4s.headers._ import org.http4s.headers._
import org.typelevel.ci.CIString import org.typelevel.ci.CIString
/** Obtain information about the client by inspecting the request. /** Obtain information about the client by inspecting the request. */
*/
object ClientRequestInfo { object ClientRequestInfo {
def getBaseUrl[F[_]](cfg: Config, req: Request[F]): LenientUri = def getBaseUrl[F[_]](cfg: Config, req: Request[F]): LenientUri =

View File

@ -12,17 +12,14 @@ import docspell.store.qb.impl.SelectBuilder
import doobie._ import doobie._
/** A sql select statement that allows to change certain parts of the query. /** A sql select statement that allows to change certain parts of the query. */
*/
sealed trait Select { sealed trait Select {
/** Builds the sql select statement into a doobie fragment. /** Builds the sql select statement into a doobie fragment. */
*/
def build: Fragment = def build: Fragment =
SelectBuilder(this) SelectBuilder(this)
/** When using this as a sub-select, an alias is required. /** When using this as a sub-select, an alias is required. */
*/
def as(alias: String): SelectExpr.SelectQuery = def as(alias: String): SelectExpr.SelectQuery =
SelectExpr.SelectQuery(this, Some(alias)) SelectExpr.SelectQuery(this, Some(alias))

View File

@ -33,16 +33,13 @@ trait PeriodicTaskStore[F[_]] {
def findNonFinalJob(pjobId: Ident): F[Option[RJob]] def findNonFinalJob(pjobId: Ident): F[Option[RJob]]
/** Insert a task or update if it already exists. /** Insert a task or update if it already exists. */
*/
def insert(task: RPeriodicTask): F[Unit] def insert(task: RPeriodicTask): F[Unit]
/** Adds the task only if it not already exists. /** Adds the task only if it not already exists. */
*/
def add(task: RPeriodicTask): F[AddResult] def add(task: RPeriodicTask): F[AddResult]
/** Find all joex nodes as registered in the database. /** Find all joex nodes as registered in the database. */
*/
def findJoexNodes: F[Vector[RNode]] def findJoexNodes: F[Vector[RNode]]
} }

View File

@ -227,8 +227,7 @@ object RAttachment {
).orderBy(a.position.asc).build.query[(RAttachment, RFileMeta)].to[Vector] ).orderBy(a.position.asc).build.query[(RAttachment, RFileMeta)].to[Vector]
} }
/** Deletes the attachment and its related source and meta records. /** Deletes the attachment and its related source and meta records. */
*/
def delete(attachId: Ident): ConnectionIO[Int] = def delete(attachId: Ident): ConnectionIO[Int] =
for { for {
n0 <- RAttachmentMeta.delete(attachId) n0 <- RAttachmentMeta.delete(attachId)

View File

@ -17,8 +17,7 @@ import docspell.store.qb._
import doobie._ import doobie._
import doobie.implicits._ import doobie.implicits._
/** Combines a source record (RSource) and a list of associated tags. /** Combines a source record (RSource) and a list of associated tags. */
*/
case class SourceData(source: RSource, tags: Vector[RTag]) case class SourceData(source: RSource, tags: Vector[RTag])
object SourceData { object SourceData {

View File

@ -33,8 +33,7 @@ import io.circe._
*/ */
trait UserTaskStore[F[_]] { trait UserTaskStore[F[_]] {
/** Return all tasks of the given user. /** Return all tasks of the given user. */
*/
def getAll(scope: UserTaskScope): Stream[F, UserTask[String]] def getAll(scope: UserTaskScope): Stream[F, UserTask[String]]
/** Return all tasks of the given name and user. The task's arguments are returned as /** Return all tasks of the given name and user. The task's arguments are returned as
@ -61,8 +60,7 @@ trait UserTaskStore[F[_]] {
implicit E: Encoder[A] implicit E: Encoder[A]
): F[Int] ): F[Int]
/** Delete the task with the given id of the given user. /** Delete the task with the given id of the given user. */
*/
def deleteTask(scope: UserTaskScope, id: Ident): F[Int] def deleteTask(scope: UserTaskScope, id: Ident): F[Int]
/** Return the task of the given user and name. If multiple exists, an error is /** Return the task of the given user and name. If multiple exists, an error is
@ -91,8 +89,7 @@ trait UserTaskStore[F[_]] {
implicit E: Encoder[A] implicit E: Encoder[A]
): F[UserTask[String]] ): F[UserTask[String]]
/** Delete all tasks of the given user that have name `name'. /** Delete all tasks of the given user that have name `name'. */
*/
def deleteAll(scope: UserTaskScope, name: Ident): F[Int] def deleteAll(scope: UserTaskScope, name: Ident): F[Int]
} }