Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ f90502399d78e7a3eb07bd7a1d130e6ae9ba498c

# Scala Steward: Reformat with scalafmt 3.9.0
4e66b2f9f7ffe02dd065ceeebb7060ed3478c6e7

# Scala Steward: Reformat with scalafmt 3.9.9
d5d11f01b82d8f2ca3af19a04e3b6d13f036b336
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.9.6"
version = "3.9.9"

preset = default
align.preset = some
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final case class AddonArchive(url: LenientUri, name: String, version: String) {
Files[F]
.exists(target)
.flatMap {
case true => target.pure[F]
case true => target.pure[F]
case false =>
Files[F].createDirectories(target) *>
reader(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object AddonRunner {
runners match {
case Nil => failWith("No runner available!")
case a :: Nil => a
case _ =>
case _ =>
new AddonRunner[F] {
val runnerType: List[RunnerType] = runners.flatMap(_.runnerType).distinct

Expand All @@ -65,7 +65,7 @@ object AddonRunner {
)
.evalMap(_.run(logger, env, ctx))
.flatMap {
case r @ AddonResult.Success(_) => Stream.emit(r.cast.some)
case r @ AddonResult.Success(_) => Stream.emit(r.cast.some)
case r @ AddonResult.ExecutionFailed(ex) =>
if (ctx.meta.isPure) {
logger.stream
Expand Down Expand Up @@ -97,7 +97,7 @@ object AddonRunner {
.last
.flatMap {
case Some(r) => r.pure[F]
case None =>
case None =>
AddonResult
.executionFailed(new NoSuchElementException("No runner left :("))
.pure[F]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ case class NewItem(metadata: Option[Meta], files: List[String]) {
Files[F]
.exists(file)
.flatMap {
case true => file.some.pure[F]
case true => file.some.pure[F]
case false =>
logger
.warn(s"File $file doesn't exist. Ignoring it.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ object Contact {
def isDocspellOpenUpload(str: String): Boolean = {
def isUploadPath(p: LenientUri.Path): Boolean =
p match {
case LenientUri.RootPath => false
case LenientUri.EmptyPath => false
case LenientUri.RootPath => false
case LenientUri.EmptyPath => false
case LenientUri.NonEmptyPath(segs, _) =>
Ident.fromString(segs.last).isRight &&
segs.init.takeRight(3) == List("open", "upload", "item")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ object DateFind {

def readFirst[A](f: Word => Option[A]): Reader[A] =
Reader {
case Nil => Result.Failure
case Nil => Result.Failure
case a :: as =>
f(a).map(value => Result.Success(value, as)).getOrElse(Result.Failure)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object Config {
val defaultStorePresent =
enabledStores.get(defaultStore) match {
case Some(_) => Validated.validNec(())
case None =>
case None =>
Validated.invalidNec(s"Default file store not present: ${defaultStore.id}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ object Login {
)(sessionKey: String, rememberToken: Option[String]): F[Result] =
loginSession(config)(sessionKey).flatMap {
case success @ Result.Ok(_, _) => (success: Result).pure[F]
case fail =>
case fail =>
rememberToken match {
case Some(token) =>
loginRememberMe(config)(token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ object Merge {

private def mergeFieldSameName(fields: NonEmptyList[FieldValue]): FieldValue =
fields.head.field.ftype match {
case CustomFieldType.Bool => fields.head
case CustomFieldType.Date => fields.head
case CustomFieldType.Bool => fields.head
case CustomFieldType.Date => fields.head
case CustomFieldType.Money =>
val amount =
fields.toList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ object OItem {
): F[AttachedEvent[UpdateResult]] =
tags.distinct match {
case Nil => AttachedEvent.only(UpdateResult.success).pure[F]
case ws =>
case ws =>
store
.transact {
(for {
Expand Down Expand Up @@ -347,7 +347,7 @@ object OItem {
): F[AttachedEvent[UpdateResult]] =
tags.distinct match {
case Nil => AttachedEvent.only(UpdateResult.success).pure[F]
case ws =>
case ws =>
store.transact {
(for {
itemIds <- OptionT
Expand Down Expand Up @@ -692,7 +692,7 @@ object OItem {
.attempt
.flatMap {
case Right(()) => ().pure[F]
case Left(ex) =>
case Left(ex) =>
logger.warn(s"Error updating full-text index: ${ex.getMessage}")
}
.as(UpdateResult.success)
Expand Down Expand Up @@ -915,7 +915,7 @@ object OItem {
case UpdateResult.Success =>
update.attempt.flatMap {
case Right(()) => ().pure[F]
case Left(ex) =>
case Left(ex) =>
logger.warn(s"Error updating full-text index: ${ex.getMessage}")
}
case UpdateResult.Failure(_) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object OItemLink {
store.add(insert, exists).flatMap {
case AddResult.Success => ().pure[F]
case AddResult.EntityExists(_) => ().pure[F]
case AddResult.Failure(ex) =>
case AddResult.Failure(ex) =>
Sync[F].raiseError(ex)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ object OMail {

store.transact(save.value).attempt.map {
case Right(Some(id)) => Right(id)
case Right(None) =>
case Right(None) =>
Left(
SendResult
.StoreFailure(new Exception(s"Could not find user to save mail."))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ object ONotification {
} yield res).attempt
.map {
case Right(res) => res
case Left(ex) =>
case Left(ex) =>
val ev =
LogEvent.of(Level.Error, "Failed sending sample event").addError(ex)
SendTestResult(success = false, Vector(ev))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ object OUpload {
_ <- checkFileList(files)
lang <- data.meta.language match {
case Some(lang) => right(lang.pure[F])
case None =>
case None =>
right(
store
.transact(RCollective.findLanguage(collectiveId))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object FileKeyPart {

implicit val jsonEncoder: Encoder[FileKeyPart] =
Encoder.instance {
case Empty => ().asJson
case Empty => ().asJson
case Collective(cid) =>
Map("collective" -> cid.asJson).asJson
case Category(cid, cat) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ object LenientUri {
def parse(str: String): Either[String, LenientUri] = {
def makePath(str: String): Either[String, Path] =
str.trim match {
case "/" => Right(RootPath)
case "" => Right(EmptyPath)
case "/" => Right(RootPath)
case "" => Right(EmptyPath)
case uriStr =>
Either.fromOption(
stripLeading(uriStr, '/')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ object MimeType {
private val charset: P[Option[Charset]] = in =>
in.trim.toLowerCase.indexOf("charset=") match {
case -1 => Right((None, in))
case n =>
case n =>
val csValueStart = in.substring(n + "charset=".length).trim
val csName = csValueStart.indexOf(';') match {
case -1 => unquote(csValueStart).trim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ object SysExec {
): F[Int] =
logOutputs(logger, basicName).use(_.waitFor(timeout).flatMap {
case rc if rc == 0 => Sync[F].pure(0)
case rc =>
case rc =>
Sync[F].raiseError(
new Exception(s"Command `${cmd.program}` returned non-zero exit code ${rc}")
)
Expand All @@ -150,7 +150,7 @@ object SysExec {
waitFor(timeout)
.flatMap {
case rc if rc == 0 => stdout.through(fs2.text.utf8.decode).compile.string
case rc =>
case rc =>
Sync[F].raiseError[String](
new Exception(
s"Command `${cmd.program}` returned non-zero exit code ${rc}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object Directory {
nonEmpty(subdir)
.flatMap {
case false => false.pure[F]
case true =>
case true =>
for {
_ <- Files[F]
.list(subdir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object EnvConfig {
else
v.charAt(current) match {
case '_' => go(current + 1, underscores + 1)
case c =>
case c =>
if (underscores > 0) {
buffer.append(underscoreMapping(underscores))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final case class Validation[C](run: C => ValidatedNec[String, C]) {

def validOrThrow(c: C): C =
run(c) match {
case Validated.Valid(cfg) => cfg
case Validated.Valid(cfg) => cfg
case Validated.Invalid(errs) =>
val msg = errs.toList.mkString("- ", "\n- ", "\n")
throw sys.error(s"\n\n$msg")
Expand All @@ -23,10 +23,10 @@ final case class Validation[C](run: C => ValidatedNec[String, C]) {
def andThen(next: Validation[C]): Validation[C] =
Validation(c =>
run(c) match {
case Validated.Valid(c2) => next.run(c2)
case Validated.Valid(c2) => next.run(c2)
case f: Validated.Invalid[NonEmptyChain[String]] =>
next.run(c) match {
case Validated.Valid(_) => f
case Validated.Valid(_) => f
case Validated.Invalid(errs2) =>
Validation.invalid(f.e ++ errs2)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ final class SolrFtsClient[F[_]: Async](
res <- Stream.eval(f(chunks.toList).attempt)
_ <- res match {
case Right(()) => Stream.emit(())
case Left(ex) =>
case Left(ex) =>
Stream.eval(logger.error(ex)("Error updating with chunk of data"))
}
} yield ()).compile.drain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object SolrSetup {
for {
current <- SolrQuery(cfg, client).findVersionDoc(versionDocId)
migs = current match {
case None => setupSchema
case None => setupSchema
case Some(ver) =>
val verDoc =
VersionDoc(versionDocId, allMigrations.map(_.value.version).max)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ object PdfConvTask {

if (cfg.convert.ocrmypdf.enabled)
checkSameFiles.flatMap {
case true => existsPdf
case true => existsPdf
case false =>
ctx.logger.info(
s"The attachment ${ctx.args.attachId} already has been converted. Skipping."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ object EvalProposals {

def nerTagFactor(tag: NerTag, mt: MetaProposalType): Double =
tag match {
case NerTag.Date => 1.0
case NerTag.Email => 0.5
case NerTag.Location => 1.0
case NerTag.Misc => 1.0
case NerTag.Date => 1.0
case NerTag.Email => 0.5
case NerTag.Location => 1.0
case NerTag.Misc => 1.0
case NerTag.Organization =>
if (mt == MetaProposalType.CorrOrg) 0.8
else 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object SaveProposals {
): F[Unit] = {
def upsert(v: RItemProposal): F[Int] =
store.add(RItemProposal.insert(v), RItemProposal.exists(v.itemId)).flatMap {
case AddResult.Success => 1.pure[F]
case AddResult.Success => 1.pure[F]
case AddResult.EntityExists(_) =>
store.transact(RItemProposal.update(v))
case AddResult.Failure(ex) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ object ScanMailboxTask {
.transact(RUserImap.getByName(ctx.args.account.userId, ctx.args.imapConnection))
.flatMap {
case Some(c) => c.pure[F]
case None =>
case None =>
Sync[F].raiseError(
new Exception(
s"No imap configuration found for: ${ctx.args.imapConnection.id}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ private[jsonminiq] object Format {

def apply(q: JsonMiniQuery): Either[String, String] =
q match {
case JsonMiniQuery.Empty => Right("")
case JsonMiniQuery.Identity => Right("")
case JsonMiniQuery.Empty => Right("")
case JsonMiniQuery.Identity => Right("")
case JsonMiniQuery.Fields(fields) =>
Right(fields.toVector.mkString(","))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ object NotificationBackend {
bes: NonEmptyList[NotificationBackend[F]]
): NotificationBackend[F] =
bes.tail match {
case Nil => bes.head
case Nil => bes.head
case next :: Nil =>
Combined(NonEmptyList.of(bes.head, next))
case next :: more =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ object PubSubT {
.subscribe(NonEmptyList.of(topic.topic))
.flatMap(m =>
m.body.as[A](topic.codec) match {
case Right(a) => Stream.emit(Message(m.head, a))
case Right(a) => Stream.emit(Message(m.head, a))
case Left(err) =>
logger.stream
.error(err)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,22 +663,22 @@ trait Conversions {
ar match {
case AddResult.Success => IdResult(success = true, successMsg, id)
case AddResult.EntityExists(msg) => IdResult(success = false, msg, Ident.unsafe(""))
case AddResult.Failure(ex) =>
case AddResult.Failure(ex) =>
IdResult(success = false, s"Internal error: ${ex.getMessage}", Ident.unsafe(""))
}

def basicResult(ar: AddResult, successMsg: String): BasicResult =
ar match {
case AddResult.Success => BasicResult(success = true, successMsg)
case AddResult.EntityExists(msg) => BasicResult(success = false, msg)
case AddResult.Failure(ex) =>
case AddResult.Failure(ex) =>
BasicResult(success = false, s"Internal error: ${ex.getMessage}")
}

def basicResult(ar: UpdateResult, successMsg: String): BasicResult =
ar match {
case UpdateResult.Success => BasicResult(success = true, successMsg)
case UpdateResult.NotFound => BasicResult(success = false, "Not found")
case UpdateResult.Success => BasicResult(success = true, successMsg)
case UpdateResult.NotFound => BasicResult(success = false, "Not found")
case UpdateResult.Failure(ex) =>
BasicResult(success = false, s"Error: ${ex.getMessage}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait MultiIdSupport {
): F[NonEmptyList[Ident]] =
ids.traverse(readId[F]).map(NonEmptyList.fromList).flatMap {
case Some(nel) => nel.pure[F]
case None =>
case None =>
F.raiseError(
DecodingFailure("Empty list found, at least one element required", Nil)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait NonEmptyListSupport {
def requireNonEmpty[F[_]: Sync, A](list: List[A]): F[NonEmptyList[A]] =
NonEmptyList.fromList(list) match {
case Some(nel) => Sync[F].pure(nel)
case None =>
case None =>
Sync[F].raiseError(new IllegalArgumentException("Empty list not allowed"))
}
}
Loading