~jan0sch/smederee

Showing details for patch a633416df70f4f5ff0e73c50f55d96482af78142.
2023-03-23 (Thu), 6:47 PM - Jens Grassel - a633416df70f4f5ff0e73c50f55d96482af78142

Code Cleanup

- mark todo items properly to match our highlighter
- remove obsolete comment from hub logback.xml
Summary of changes
12 files modified with 16 lines added and 17 lines removed
  • build.sbt with 1 added and 1 removed lines
  • modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala with 3 added and 3 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala with 1 added and 1 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala with 1 added and 1 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala with 1 added and 1 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala with 1 added and 1 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala with 3 added and 3 removed lines
  • modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala with 2 added and 2 removed lines
  • modules/hub/src/main/scala/de/smederee/tickets/LabelRoutes.scala with 1 added and 1 removed lines
  • modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala with 1 added and 1 removed lines
  • modules/hub/src/universal/conf/logback.xml with 0 added and 1 removed lines
  • modules/tickets/src/main/scala/de/smederee/tickets/Project.scala with 1 added and 1 removed lines
diff -rN -u old-smederee/build.sbt new-smederee/build.sbt
--- old-smederee/build.sbt	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/build.sbt	2025-01-31 07:49:19.121573320 +0000
@@ -365,7 +365,7 @@
       )
     )
 
-// FIXME This is a workaround until http4s-twirl gets published properly for Scala 3!
+// FIXME: This is a workaround until http4s-twirl gets published properly for Scala 3!
 lazy val twirl =
   project
     .in(file("twirl"))
diff -rN -u old-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala new-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala
--- old-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/email/src/main/scala/de/smederee/email/EmailMiddleware.scala	2025-01-31 07:49:19.121573320 +0000
@@ -135,7 +135,7 @@
         else
           None
     }
-    // Check against a regular expression. TODO Maybe we can skip the other tests alltogether?
+    // Check against a regular expression. TODO: Maybe we can skip the other tests alltogether?
     val passesRegularExpression = Option(source).filter(validateString.matches)
     // Validate pre-conditions
     (notEmpty, hasAtChar, hasDotChar, belowMaxLength, lastPartValid, passesRegularExpression).mapN {
@@ -203,7 +203,7 @@
         else
           None
     }
-    // Check against a regular expression. TODO Maybe we can skip the other tests alltogether?
+    // Check against a regular expression. TODO: Maybe we can skip the other tests alltogether?
     val passesRegularExpression = Option(source).filter(validateString.matches)
     // Validate pre-conditions
     (notEmpty, hasAtChar, hasDotChar, belowMaxLength, lastPartValid, passesRegularExpression).mapN {
@@ -299,7 +299,7 @@
         else
           None
     }
-    // Check against a regular expression. TODO Maybe we can skip the other tests alltogether?
+    // Check against a regular expression. TODO: Maybe we can skip the other tests alltogether?
     val passesRegularExpression = Option(source).filter(validateString.matches)
     // Validate pre-conditions
     (notEmpty, hasAtChar, hasDotChar, belowMaxLength, lastPartValid, passesRegularExpression).mapN {
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/AccountManagementRoutes.scala	2025-01-31 07:49:19.121573320 +0000
@@ -309,7 +309,7 @@
         subject <- Sync[F].delay(SubjectLine("Smederee - Please validate your email address."))
         body <- Sync[F].delay(
           TextBody(views.txt.emails.validate(user, token, uri).toString)
-        ) // TODO extension method?
+        ) // TODO: extension method?
         message <- Sync[F].delay(EmailMessage(from, to, List.empty, List.empty, subject, body))
         result  <- emailMiddleware.send(message)
         response <- result match {
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/DoobieVcsMetadataRepository.scala	2025-01-31 07:49:19.121573320 +0000
@@ -119,7 +119,7 @@
         if (account.uid === owner.uid)
           whereAnd(ownerFilter) // The user asks for their own repositories.
         else
-          whereAnd(ownerFilter, fr""""repos".is_private = FALSE""") // TODO More logic later (groups, perms).
+          whereAnd(ownerFilter, fr""""repos".is_private = FALSE""") // TODO: More logic later (groups, perms).
     }
     val query = selectRepositoryColumns ++ whereClause ++ fr"""ORDER BY name ASC"""
     query.query[VcsRepository].stream.transact(tx)
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala	2025-01-31 07:49:19.121573320 +0000
@@ -67,7 +67,7 @@
         }
         form <- Sync[F].delay(SignupForm.validate(formData))
         // Only check for existing email or username if the first validation was successful.
-        // TODO Find a way to remove the nesting of `Validated[Validated[...]]` to also remove the nested pattern match later on.
+        // TODO: Find a way to remove the nesting of `Validated[Validated[...]]` to also remove the nested pattern match later on.
         checkExisting <- form.traverse { signupForm =>
           for {
             duplicateEmail <- repo.findEmail(signupForm.email)
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala	2025-01-31 07:49:19.121573320 +0000
@@ -844,7 +844,7 @@
           _ <- Sync[F].raiseUnless(user.validatedEmail)(
             new Error(
               "An unvalidated account is not allowed to create a repository!"
-            ) // FIXME Proper error handling!
+            ) // FIXME: Proper error handling!
           )
           formData <- Sync[F].delay {
             urlForm.values.map { t =>
@@ -938,7 +938,7 @@
           _ <- Sync[F].raiseUnless(user.validatedEmail)(
             new Error(
               "An unvalidated account is not allowed to edit a repository!"
-            ) // FIXME Proper error handling!
+            ) // FIXME: Proper error handling!
           )
           owner <- vcsMetadataRepo.findVcsRepositoryOwner(repositoryOwnerName)
           loadedRepo <- owner match {
@@ -973,7 +973,7 @@
           _ <- Sync[F].raiseUnless(user.validatedEmail)(
             new Error(
               "An unvalidated account is not allowed to edit a repository!"
-            ) // FIXME Proper error handling!
+            ) // FIXME: Proper error handling!
           )
           repoAndId <- loadRepo(user.some)(repositoryOwnerName, repositoryName)
           repo = repoAndId.map(_._1)
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepository.scala	2025-01-31 07:49:19.121573320 +0000
@@ -70,7 +70,7 @@
 
   given Order[VcsRepositoryName] = Order.from((a, b) => a.toString.compareTo(b.toString))
 
-  // TODO Can we rewrite this in a Scala-3 way (i.e. without implicitly)?
+  // TODO: Can we rewrite this in a Scala-3 way (i.e. without implicitly)?
   given Ordering[VcsRepositoryName] = implicitly[Order[VcsRepositoryName]].toOrdering
 
   val Format: Regex = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{1,63}$".r
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala new-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala	2025-01-31 07:49:19.121573320 +0000
@@ -290,7 +290,7 @@
           .mapN { case (owner, repository) =>
             if (repositoryIsReadableBy(owner.toUsername, repository, sshKeyOwnerId))
               // new DarcsTransferMode(darcsConfiguration, owner.toUsername, repository)
-              new UnknownCommand(command) // FIXME Make transfer-mode work (stalls currently).
+              new UnknownCommand(command) // FIXME: Make transfer-mode work (stalls currently).
             else
               new UnknownCommand("You are only allowed to access your own repositories!")
           }
@@ -350,5 +350,5 @@
   // val FilterScpCommand: Regex = "^scp (-f) ((--)\\s)?([^\u0000]+)$".r
   val FilterScpCommand: Regex =
     "^scp (-f) ((--)\\s)?([a-z][a-z0-9]{1,31})/([a-zA-Z0-9][a-zA-Z0-9\\-_]{1,63})/([^\u0000]+)$".r
-  // TODO Add support for sftp because that could be enforced from the client side.
+  // TODO: Add support for sftp because that could be enforced from the client side.
 }
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/tickets/LabelRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/tickets/LabelRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/tickets/LabelRoutes.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/tickets/LabelRoutes.scala	2025-01-31 07:49:19.121573320 +0000
@@ -133,7 +133,7 @@
             case _                          => None
           }
       }
-      // TODO Replace with whatever we implement as proper permission model. ;-)
+      // TODO: Replace with whatever we implement as proper permission model. ;-)
       projectAndId = currentUser match {
         case None => loadedRepo.filter(tuple => tuple._1.isPrivate === false)
         case Some(user) =>
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala	2025-01-31 07:49:19.121573320 +0000
@@ -130,7 +130,7 @@
             case _                          => None
           }
       }
-      // TODO Replace with whatever we implement as proper permission model. ;-)
+      // TODO: Replace with whatever we implement as proper permission model. ;-)
       repoAndId = currentUser match {
         case None => loadedRepo.filter(tuple => tuple._1.isPrivate === false)
         case Some(user) =>
diff -rN -u old-smederee/modules/hub/src/universal/conf/logback.xml new-smederee/modules/hub/src/universal/conf/logback.xml
--- old-smederee/modules/hub/src/universal/conf/logback.xml	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/hub/src/universal/conf/logback.xml	2025-01-31 07:49:19.121573320 +0000
@@ -19,7 +19,6 @@
         <!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender-->
         <file>logs/${runId}.log</file>
         <encoder>
-          <!-- TODO Maybe we should add `akkaSource` to the log? -->
           <pattern>%date %-5level %logger{0} - %msg%n</pattern>
         </encoder>
         <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
diff -rN -u old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Project.scala new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Project.scala
--- old-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Project.scala	2025-01-31 07:49:19.117573314 +0000
+++ new-smederee/modules/tickets/src/main/scala/de/smederee/tickets/Project.scala	2025-01-31 07:49:19.121573320 +0000
@@ -58,7 +58,7 @@
 
   given Order[ProjectName] = Order.from((a, b) => a.toString.compareTo(b.toString))
 
-  // TODO Can we rewrite this in a Scala-3 way (i.e. without implicitly)?
+  // TODO: Can we rewrite this in a Scala-3 way (i.e. without implicitly)?
   given Ordering[ProjectName] = implicitly[Order[ProjectName]].toOrdering
 
   val Format: Regex = "^[a-zA-Z0-9][a-zA-Z0-9\\-_]{1,63}$".r