~jan0sch/smederee

Showing details for patch 8c9a195c8e766ec19566feabb8ec46e6c47d286d.
2023-05-11 (Thu), 8:26 AM - Jens Grassel - 8c9a195c8e766ec19566feabb8ec46e6c47d286d

Code Cleanup: Fix some warnings.

Summary of changes
8 files modified with 16 lines added and 5 lines removed
  • modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala with 3 added and 0 removed lines
  • modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala with 3 added and 0 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala with 1 added and 1 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/MarkdownRenderer.scala with 2 added and 0 removed lines
  • modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala with 2 added and 2 removed lines
  • modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.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/tickets/src/it/scala/de/smederee/tickets/BaseSpec.scala with 3 added and 0 removed lines
diff -rN -u old-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala new-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala
--- old-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala	2025-01-30 22:42:11.216216904 +0000
+++ new-smederee/modules/darcs/src/test/scala/de/smederee/darcs/DarcsCommandsTest.scala	2025-01-30 22:42:11.216216904 +0000
@@ -25,9 +25,12 @@
 
 import munit._
 
+import scala.annotation.nowarn
+
 final class DarcsCommandsTest extends CatsEffectSuite with TestHelpers {
   val darcsBinary = Paths.get("darcs")
 
+  @nowarn("msg=discarded non-Unit value.*")
   val tempWorkingDirectory = ResourceFixture(
     Resource.make(IO(Files.createTempDirectory("darcs-cmd-test-").toAbsolutePath()))(path => IO(deleteDirectory(path)))
   )
diff -rN -u old-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala new-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala
--- old-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala	2025-01-30 22:42:11.216216904 +0000
+++ new-smederee/modules/hub/src/it/scala/de/smederee/hub/BaseSpec.scala	2025-01-30 22:42:11.216216904 +0000
@@ -35,6 +35,8 @@
 
 import munit._
 
+import scala.annotation.nowarn
+
 /** Base class for our integration test suites.
   *
   * It loads and provides the configuration as a resource suit fixture (loaded once for all tests within a suite) and
@@ -72,6 +74,7 @@
       )
     } yield connection
 
+  @nowarn("msg=discarded non-Unit value.*")
   override def beforeAll(): Unit = {
     // Extract the database name from the URL.
     val database = configuration.database.url.split("/").reverse.take(1).mkString
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala	2025-01-30 22:42:11.216216904 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/AuthenticationRoutes.scala	2025-01-30 22:42:11.216216904 +0000
@@ -168,7 +168,7 @@
 
   // private val parseResetPasswordForm = ???
 
-  private val logout: AuthedRoutes[Account, F] = AuthedRoutes.of { case ar @ POST -> Root / "logout" as user =>
+  private val logout: AuthedRoutes[Account, F] = AuthedRoutes.of { case ar @ POST -> Root / "logout" as _ =>
     for {
       authToken <- Sync[F].delay(ar.req.getAuthenticationToken)
       sessionId <- Sync[F].delay(authToken.flatMap(signAndValidate.validate).flatMap(SessionId.from))
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/MarkdownRenderer.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/MarkdownRenderer.scala
--- old-smederee/modules/hub/src/main/scala/de/smederee/hub/MarkdownRenderer.scala	2025-01-30 22:42:11.216216904 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/MarkdownRenderer.scala	2025-01-30 22:42:11.216216904 +0000
@@ -30,6 +30,7 @@
 import org.http4s.Uri
 import org.slf4j.{ Logger, LoggerFactory }
 
+import scala.annotation.nowarn
 import scala.jdk.CollectionConverters._
 import scala.util.matching.Regex
 
@@ -77,6 +78,7 @@
   @SuppressWarnings(
     Array("scalafix:DisableSyntax.isInstanceOf")
   ) // TODO: Find a way to get rid of the isInstanceOf below.
+  @nowarn("msg=discarded non-Unit value.*")
   class LinkHrefCorrector(private val repo: Option[VcsRepository]) extends AttributeProvider {
     override def setAttributes(node: Node, tagName: String, attributes: java.util.Map[String, String]): Unit =
       if (node.isInstanceOf[Link]) {
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-30 22:42:11.216216904 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/SignupRoutes.scala	2025-01-30 22:42:11.216216904 +0000
@@ -128,7 +128,7 @@
   }
 
   private val parseSignUpFormForLoggedInUsers: AuthedRoutes[Account, F] = AuthedRoutes.of {
-    case ar @ POST -> Root / "signup" as _ =>
+    case _ @POST -> Root / "signup" as _ =>
       SeeOther(Location(Uri(path = Uri.Path.Root))) // Redirect already logged in users.
   }
 
@@ -141,7 +141,7 @@
   }
 
   private val showSignUpFormForLoggedInUsers: AuthedRoutes[Account, F] = AuthedRoutes.of {
-    case ar @ GET -> Root / "signup" as _ =>
+    case _ @GET -> Root / "signup" as _ =>
       SeeOther(Location(Uri(path = Uri.Path.Root))) // Redirect already logged in users.
   }
 
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-30 22:42:11.216216904 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/ssh/DarcsSshCommand.scala	2025-01-30 22:42:11.220216911 +0000
@@ -300,7 +300,7 @@
               new UnknownCommand("You are only allowed to access your own repositories!")
           }
           .getOrElse(new UnknownCommand(command))
-      case DarcsSshCommandFactory.FilterScpCommand("-f", ignored, "--", owner, repository, path) =>
+      case DarcsSshCommandFactory.FilterScpCommand("-f", _, "--", owner, repository, path) =>
         (
           SshUsername.from(owner),
           VcsRepositoryName.from(repository)
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-30 22:42:11.216216904 +0000
+++ new-smederee/modules/hub/src/main/scala/de/smederee/tickets/MilestoneRoutes.scala	2025-01-30 22:42:11.220216911 +0000
@@ -420,7 +420,7 @@
           case _                    => Sync[F].delay(None)
         }
         resp <- (projectAndId, milestone) match {
-          case (Some(project, projectId), Some(milestone)) =>
+          case (Some(project, _), Some(milestone)) =>
             for {
               projectBaseUri <- Sync[F].delay(
                 linkConfig.createFullUri(
diff -rN -u old-smederee/modules/tickets/src/it/scala/de/smederee/tickets/BaseSpec.scala new-smederee/modules/tickets/src/it/scala/de/smederee/tickets/BaseSpec.scala
--- old-smederee/modules/tickets/src/it/scala/de/smederee/tickets/BaseSpec.scala	2025-01-30 22:42:11.216216904 +0000
+++ new-smederee/modules/tickets/src/it/scala/de/smederee/tickets/BaseSpec.scala	2025-01-30 22:42:11.220216911 +0000
@@ -32,6 +32,8 @@
 
 import munit._
 
+import scala.annotation.nowarn
+
 /** Base class for our integration test suites.
   *
   * It loads and provides the configuration as a resource suit fixture (loaded once for all tests within a suite) and
@@ -68,6 +70,7 @@
       )
     } yield connection
 
+  @nowarn("msg=discarded non-Unit value.*")
   override def beforeAll(): Unit = {
     // Extract the database name from the URL.
     val database = configuration.database.url.split("/").reverse.take(1).mkString