Skip to content

Commit d11034f

Browse files
committed
Reformat all files due to new rules
1 parent 956011e commit d11034f

File tree

73 files changed

+443
-422
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+443
-422
lines changed

build.sbt

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.typesafe.sbt.SbtGit.GitKeys._
55
val elmCompileMode = settingKey[ElmCompileMode]("How to compile elm sources")
66

77
val scalafixSettings = Seq(
8-
semanticdbEnabled := true, // enable SemanticDB
8+
semanticdbEnabled := true, // enable SemanticDB
99
semanticdbVersion := scalafixSemanticdb.revision, //"4.4.0"
1010
ThisBuild / scalafixDependencies ++= Dependencies.organizeImports
1111
)
@@ -78,8 +78,8 @@ val webjarSettings = Seq(
7878
)
7979

8080
val debianSettings = Seq(
81-
maintainer := "Eike Kettner <eike.kettner@posteo.de>",
82-
packageSummary := description.value,
81+
maintainer := "Eike Kettner <eike.kettner@posteo.de>",
82+
packageSummary := description.value,
8383
packageDescription := description.value,
8484
Universal / mappings += {
8585
val conf = (Compile / resourceDirectory).value / "reference.conf"
@@ -149,9 +149,9 @@ val restapi = project
149149
libraryDependencies ++=
150150
Dependencies.circe,
151151
openapiTargetLanguage := Language.Scala,
152-
openapiPackage := Pkg("sharry.restapi.model"),
153-
openapiSpec := (Compile / resourceDirectory).value / "sharry-openapi.yml",
154-
openapiStaticGen := OpenApiDocGenerator.Redoc,
152+
openapiPackage := Pkg("sharry.restapi.model"),
153+
openapiSpec := (Compile / resourceDirectory).value / "sharry-openapi.yml",
154+
openapiStaticGen := OpenApiDocGenerator.Redoc,
155155
openapiScalaConfig := ScalaConfig()
156156
.withJson(ScalaJson.circeSemiauto)
157157
.addMapping(CustomMapping.forType { case TypeDef("LocalDateTime", _) =>
@@ -216,9 +216,9 @@ val webapp = project
216216
.settings(webjarSettings)
217217
.settings(stylesSettings)
218218
.settings(
219-
name := "sharry-webapp",
219+
name := "sharry-webapp",
220220
openapiTargetLanguage := Language.Elm,
221-
openapiPackage := Pkg("Api.Model"),
221+
openapiPackage := Pkg("Api.Model"),
222222
openapiSpec := (restapi / Compile / resourceDirectory).value / "sharry-openapi.yml",
223223
openapiElmConfig := ElmConfig().withJson(ElmJson.decodePipeline)
224224
)
@@ -280,39 +280,39 @@ lazy val microsite = project
280280
.disablePlugins(ReleasePlugin, RevolverPlugin)
281281
.settings(sharedSettings)
282282
.settings(
283-
name := "sharry-microsite",
283+
name := "sharry-microsite",
284284
publishArtifact := false,
285-
publish / skip := true,
285+
publish / skip := true,
286286
micrositeFooterText := Some(
287287
"""
288288
|<p>&copy; 2021 <a href="https://eikek.github.io/sharry">Sharry, v{{site.version}}</a></p>
289289
|""".stripMargin
290290
),
291-
micrositeName := "Sharry",
292-
micrositeDescription := "Sharry – Share files conveniently",
291+
micrositeName := "Sharry",
292+
micrositeDescription := "Sharry – Share files conveniently",
293293
micrositeDocumentationUrl := "/sharry/doc",
294294
micrositeFavicons := Seq(microsites.MicrositeFavicon("favicon-32x32.png", "32x32")),
295-
micrositeBaseUrl := "/sharry",
296-
micrositeAuthor := "eikek",
297-
micrositeGithubOwner := "eikek",
298-
micrositeGithubRepo := "sharry",
299-
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
300-
micrositePushSiteWith := GitHub4s,
295+
micrositeBaseUrl := "/sharry",
296+
micrositeAuthor := "eikek",
297+
micrositeGithubOwner := "eikek",
298+
micrositeGithubRepo := "sharry",
299+
micrositeGithubToken := sys.env.get("GITHUB_TOKEN"),
300+
micrositePushSiteWith := GitHub4s,
301301
micrositeGitterChannel := false,
302302
micrositeShareOnSocial := false,
303303
micrositePalette := Map(
304-
"brand-primary" -> "#7a1800",
304+
"brand-primary" -> "#7a1800",
305305
"brand-secondary" -> "#009ADA",
306-
"white-color" -> "#FFFFFF"
306+
"white-color" -> "#FFFFFF"
307307
),
308308
run / fork := true,
309309
mdocVariables := Map(
310-
"VERSION" -> version.value,
310+
"VERSION" -> version.value,
311311
"PVERSION" -> version.value.replace('.', '_')
312312
),
313313
Compile / resourceGenerators += Def.task {
314314
val conf1 = (restserver / Compile / resourceDirectory).value / "reference.conf"
315-
val out1 = resourceManaged.value / "main" / "jekyll" / "_includes" / "server.conf"
315+
val out1 = resourceManaged.value / "main" / "jekyll" / "_includes" / "server.conf"
316316
streams.value.log.info(s"Copying reference.conf: $conf1 -> $out1")
317317
IO.write(out1, "{% raw %}\n")
318318
IO.append(out1, IO.readBytes(conf1))
@@ -391,7 +391,7 @@ def compileElm(
391391
}
392392

393393
def createWebjarSource(wj: Seq[ModuleID], out: File): Seq[File] = {
394-
val target = out / "Webjars.scala"
394+
val target = out / "Webjars.scala"
395395
val invalidChars = "-.".toSet
396396
val fields = wj
397397
.map(m =>
@@ -400,10 +400,10 @@ def createWebjarSource(wj: Seq[ModuleID], out: File): Seq[File] = {
400400
)
401401
.mkString("\n\n")
402402
val content = s"""package sharry.restserver.webapp
403-
|object Webjars {
404-
|$fields
405-
|}
406-
|""".stripMargin
403+
|object Webjars {
404+
|$fields
405+
|}
406+
|""".stripMargin
407407

408408
IO.write(target, content)
409409
Seq(target)

modules/backend/src/main/scala/sharry/backend/BackendApp.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@ object BackendApp {
3535
def create[F[_]: Async](cfg: Config, store: Store[F]): Resource[F, BackendApp[F]] =
3636
for {
3737
accountImpl <- OAccount[F](store)
38-
loginImpl <- Login[F](accountImpl)
39-
signupImpl <- OSignup[F](store)
40-
aliasImpl <- OAlias[F](store)
41-
shareImpl <- OShare[F](store, cfg.share)
42-
mailImpl <- OMail[F](store, cfg.mail, JavaMailEmil[F]())
38+
loginImpl <- Login[F](accountImpl)
39+
signupImpl <- OSignup[F](store)
40+
aliasImpl <- OAlias[F](store)
41+
shareImpl <- OShare[F](store, cfg.share)
42+
mailImpl <- OMail[F](store, cfg.mail, JavaMailEmil[F]())
4343
} yield new BackendApp[F] {
44-
val login: Login[F] = loginImpl
45-
val signup: OSignup[F] = signupImpl
44+
val login: Login[F] = loginImpl
45+
val signup: OSignup[F] = signupImpl
4646
val account: OAccount[F] = accountImpl
47-
val alias: OAlias[F] = aliasImpl
48-
val share: OShare[F] = shareImpl
49-
val mail: OMail[F] = mailImpl
47+
val alias: OAlias[F] = aliasImpl
48+
val share: OShare[F] = shareImpl
49+
val mail: OMail[F] = mailImpl
5050
}
5151

5252
def apply[F[_]: Async](
5353
cfg: Config,
5454
connectEC: ExecutionContext
5555
): Resource[F, BackendApp[F]] =
5656
for {
57-
store <- Store.create(cfg.jdbc, cfg.share.chunkSize, connectEC, true)
57+
store <- Store.create(cfg.jdbc, cfg.share.chunkSize, connectEC, true)
5858
backend <- create(cfg, store)
5959
_ <-
6060
PeriodicCleanup.resource(cfg.cleanup, cfg.signup, backend.share, backend.signup)

modules/backend/src/main/scala/sharry/backend/account/OAccount.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ object OAccount {
6666
val change = for {
6767
acc <- OptionT(findById(id))
6868
pwmatch = PasswordCrypt.check(oldPw, acc.password)
69-
intern = acc.source == AccountSource.Intern
69+
intern = acc.source == AccountSource.Intern
7070
res <-
7171
if (!intern) OptionT.some[F](notInternal)
7272
else if (!pwmatch) OptionT.some[F](wrongPassword)
@@ -78,8 +78,8 @@ object OAccount {
7878

7979
def delete(id: Ident): OptionT[F, RAccount] =
8080
for {
81-
_ <- OptionT.liftF(logger.finfo(s"Delete account $id"))
82-
acc <- OptionT(store.transact(RAccount.findById(id)))
81+
_ <- OptionT.liftF(logger.finfo(s"Delete account $id"))
82+
acc <- OptionT(store.transact(RAccount.findById(id)))
8383
shares <- OptionT.liftF(store.transact(RShare.getAllByAccount(id)))
8484
_ <- OptionT.liftF(logger.finfo(s"Delete ${shares.size} shares of account $id"))
8585
_ <- OptionT.liftF(
@@ -140,7 +140,7 @@ object OAccount {
140140
_ => {
141141
val msg = s"The account '${acc.login.id}' already exists."
142142
for {
143-
acc <- makeRecord
143+
acc <- makeRecord
144144
save <- store.add(insert(acc), accountExists)
145145
} yield save.fold(identity, _.withMsg(msg), identity)
146146
}

modules/backend/src/main/scala/sharry/backend/account/Queries.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ object Queries {
3333
}
3434

3535
private def findAccountFragment(where1: Fragment): Query0[AccountItem] = {
36-
val aId = "a" :: RAccount.Columns.id
36+
val aId = "a" :: RAccount.Columns.id
3737
val sAcc = "s" :: RShare.Columns.accountId
38-
val sId = "s" :: RShare.Columns.id
38+
val sId = "s" :: RShare.Columns.id
3939

4040
val cols = RAccount.Columns.all
4141
.map("a" :: _)

modules/backend/src/main/scala/sharry/backend/auth/AuthToken.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ object AuthToken {
4343
case Array(ms, as, salt, sig) =>
4444
for {
4545
millis <- asInt(ms).toRight("Cannot read authenticator data")
46-
acc <- b64dec(as).toRight("Cannot read authenticator data")
47-
accId <- AccountId.parse(acc)
46+
acc <- b64dec(as).toRight("Cannot read authenticator data")
47+
accId <- AccountId.parse(acc)
4848
} yield AuthToken(millis, accId, salt, sig)
4949

5050
case _ =>
@@ -55,8 +55,8 @@ object AuthToken {
5555
for {
5656
salt <- Common.genSaltString[F]
5757
millis = Instant.now.toEpochMilli
58-
cd = AuthToken(millis, accountId, salt, "")
59-
sig = sign(cd, key)
58+
cd = AuthToken(millis, accountId, salt, "")
59+
sig = sign(cd, key)
6060
} yield cd.copy(sig = sig)
6161

6262
private def sign(cd: AuthToken, key: ByteVector): String = {

modules/backend/src/main/scala/sharry/backend/auth/CommandAuth.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ final class CommandAuth[F[_]: Async](
3333
)
3434

3535
for {
36-
_ <- logger.fdebug(s"CommandAuth: starting login $up")
37-
res <- runCommand(up, cfg.command)
36+
_ <- logger.fdebug(s"CommandAuth: starting login $up")
37+
res <- runCommand(up, cfg.command)
3838
resp <- if (res) okResult else LoginResult.invalidAuth.pure[F]
39-
_ <- logger.fdebug(s"CommandAuth: $up => $resp")
39+
_ <- logger.fdebug(s"CommandAuth: $up => $resp")
4040
} yield resp
4141

4242
case Left(_) =>

modules/backend/src/main/scala/sharry/backend/auth/FixedAuth.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ final class FixedAuth[F[_]: Async](cfg: AuthConfig, op: OAccount[F]) {
2828
(None: Option[LoginResult]).pure[F]
2929
else if (up.pass == cfg.fixed.password)
3030
for {
31-
_ <- logger.fdebug(s"Fixed auth: success for user ${cfg.fixed.user}")
32-
id <- addAccount(cfg.fixed)
31+
_ <- logger.fdebug(s"Fixed auth: success for user ${cfg.fixed.user}")
32+
id <- addAccount(cfg.fixed)
3333
token <- AuthToken.user(id, cfg.serverSecret)
3434
} yield LoginResult.ok(token).some
3535
else

modules/backend/src/main/scala/sharry/backend/auth/HttpAuth.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ final class HttpAuth[F[_]: Async](
3434
)
3535

3636
for {
37-
_ <- logger.fdebug(s"HttpAuth: starting login $up")
38-
res <- executeReq(up, cfg.http)
37+
_ <- logger.fdebug(s"HttpAuth: starting login $up")
38+
res <- executeReq(up, cfg.http)
3939
resp <- if (res) okResult else LoginResult.invalidAuth.pure[F]
40-
_ <- logger.fdebug(s"HttpAuth: $up => $resp")
40+
_ <- logger.fdebug(s"HttpAuth: $up => $resp")
4141
} yield resp
4242

4343
case Left(_) =>

modules/backend/src/main/scala/sharry/backend/auth/HttpBasicAuth.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ final class HttpBasicAuth[F[_]: Async](
3333
)
3434

3535
for {
36-
_ <- logger.fdebug(s"HttpBasicAuth: starting login $up")
37-
res <- executeReq(up, cfg.httpBasic)
36+
_ <- logger.fdebug(s"HttpBasicAuth: starting login $up")
37+
res <- executeReq(up, cfg.httpBasic)
3838
resp <- if (res) okResult else LoginResult.invalidAuth.pure[F]
39-
_ <- logger.fdebug(s"HttpBasicAuth: $up => $resp")
39+
_ <- logger.fdebug(s"HttpBasicAuth: $up => $resp")
4040
} yield resp
4141

4242
case Left(_) =>

modules/backend/src/main/scala/sharry/backend/auth/InternalAuth.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ final class InternalAuth[F[_]: Async](cfg: AuthConfig, op: OAccount[F]) {
2626
AuthToken.user(accId, cfg.serverSecret).map(LoginResult.ok)
2727

2828
for {
29-
_ <- logger.ftrace(s"Internal auth: doing account lookup: ${login.id}")
29+
_ <- logger.ftrace(s"Internal auth: doing account lookup: ${login.id}")
3030
data <- op.findByLogin(login)
31-
_ <- logger.ftrace(s"Internal auth: Account lookup: $data")
31+
_ <- logger.ftrace(s"Internal auth: Account lookup: $data")
3232
res <-
3333
data
3434
.filter(check(up.pass))

modules/backend/src/main/scala/sharry/backend/auth/LoginModule.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object LoginModule {
4747
Ident.fromString(up.user) match {
4848
case Right(login) =>
4949
(for {
50-
_ <- OptionT(op.findByLogin(login)).filter(_.source == src)
50+
_ <- OptionT(op.findByLogin(login)).filter(_.source == src)
5151
res <- OptionT.liftF(f.run(up))
5252
} yield res).value
5353
case Left(_) =>

modules/backend/src/main/scala/sharry/backend/auth/LoginResult.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ object LoginResult {
1616
}
1717

1818
def ok(session: AuthToken): LoginResult = Ok(session)
19-
def invalidAuth: LoginResult = InvalidAuth
20-
def invalidTime: LoginResult = InvalidTime
19+
def invalidAuth: LoginResult = InvalidAuth
20+
def invalidTime: LoginResult = InvalidTime
2121
}

modules/backend/src/main/scala/sharry/backend/job/PeriodicCleanup.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ object PeriodicCleanup {
7272
signupOps: OSignup[F]
7373
): F[Unit] =
7474
for {
75-
_ <- logger.fdebug("Cleanup expired shares...")
75+
_ <- logger.fdebug("Cleanup expired shares...")
7676
shareN <- shareOps.cleanupExpired(cleanupCfg.invalidAge)
77-
_ <- logger.finfo(s"Cleaned up $shareN expired shares.")
78-
_ <- logger.fdebug("Cleanup expired invites...")
79-
invN <- signupOps.cleanInvites(signupCfg)
80-
_ <- logger.finfo(s"Removed $invN expired invitations.")
81-
_ <- logger.fdebug("Deleting orphaned files ...")
82-
orphN <- shareOps.deleteOrphanedFiles
83-
_ <- logger.finfo(s"Deleted $orphN orphaned files.")
77+
_ <- logger.finfo(s"Cleaned up $shareN expired shares.")
78+
_ <- logger.fdebug("Cleanup expired invites...")
79+
invN <- signupOps.cleanInvites(signupCfg)
80+
_ <- logger.finfo(s"Removed $invN expired invitations.")
81+
_ <- logger.fdebug("Deleting orphaned files ...")
82+
orphN <- shareOps.deleteOrphanedFiles
83+
_ <- logger.finfo(s"Deleted $orphN orphaned files.")
8484
} yield ()
8585

8686
}

modules/backend/src/main/scala/sharry/backend/mail/MailSendResult.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ sealed trait MailSendResult {}
44

55
object MailSendResult {
66

7-
def success: MailSendResult = Success
7+
def success: MailSendResult = Success
88
def sendFailure(ex: Throwable): MailSendResult = SendFailure(ex)
9-
def noRecipients: MailSendResult = NoRecipients
10-
def noSender: MailSendResult = NoSender
11-
def featureDisabled: MailSendResult = FeatureDisabled
9+
def noRecipients: MailSendResult = NoRecipients
10+
def noSender: MailSendResult = NoSender
11+
def featureDisabled: MailSendResult = FeatureDisabled
1212

1313
case object Success extends MailSendResult
1414

modules/backend/src/main/scala/sharry/backend/mail/NotifyResult.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ object NotifyResult {
1414
def featureDisabled: NotifyResult = FeatureDisabled
1515

1616
case object InvalidAlias extends NotifyResult {
17-
val isSuccess = false
17+
val isSuccess = false
1818
def receiver: Option[MailAddress] = None
1919
}
2020

2121
case object FeatureDisabled extends NotifyResult {
22-
val isSuccess = false
22+
val isSuccess = false
2323
def receiver: Option[MailAddress] = None
2424
}
2525

2626
case class SendFailed(mail: MailAddress, err: String) extends NotifyResult {
27-
val isSuccess = false
27+
val isSuccess = false
2828
def receiver: Option[MailAddress] = Some(mail)
2929
}
3030

3131
case class SendSuccessful(mail: MailAddress) extends NotifyResult {
32-
val isSuccess = true
32+
val isSuccess = true
3333
def receiver: Option[MailAddress] = Some(mail)
3434
}
3535

modules/backend/src/main/scala/sharry/backend/mail/OMail.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ object OMail {
112112
): OptionT[F, MailData] =
113113
for {
114114
t <- OptionT(store.transact(Queries.publishIdAndPassword(acc.id, shareId)))
115-
td = TemplateData(acc.userLogin, baseUrl / t._2.id, t._1, "")
115+
td = TemplateData(acc.userLogin, baseUrl / t._2.id, t._1, "")
116116
tpl = cfg.templates.download
117117
} yield MailData(td.render(tpl.subject), td.render(tpl.body))
118118

@@ -122,7 +122,7 @@ object OMail {
122122
baseUrl: LenientUri
123123
): F[MailData] = {
124124
val tpl = cfg.templates.alias
125-
val td = TemplateData(acc.userLogin, baseUrl / aliasId.id, false, "")
125+
val td = TemplateData(acc.userLogin, baseUrl / aliasId.id, false, "")
126126
MailData(td.render(tpl.subject), td.render(tpl.body)).pure[F]
127127
}
128128

0 commit comments

Comments
 (0)