From 60367bbb305ddeeff8e486926e22f877374ab675 Mon Sep 17 00:00:00 2001 From: Philippus Baalman Date: Thu, 24 Oct 2024 14:49:44 +0200 Subject: [PATCH] chore: Avoid partial function in groupBy (#21) --- .../com/markatta/akka/sbtvc/AkkaVersionCheckPlugin.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/scala/com/markatta/akka/sbtvc/AkkaVersionCheckPlugin.scala b/src/main/scala/com/markatta/akka/sbtvc/AkkaVersionCheckPlugin.scala index 4a89d52..7bd527c 100644 --- a/src/main/scala/com/markatta/akka/sbtvc/AkkaVersionCheckPlugin.scala +++ b/src/main/scala/com/markatta/akka/sbtvc/AkkaVersionCheckPlugin.scala @@ -52,15 +52,15 @@ object AkkaVersionCheckPlugin extends AutoPlugin { def checkModuleVersions(updateReport: UpdateReport, log: Logger): AkkaVersionReport = { log.debug("Checking Akka module versions") val allModules = updateReport.allModules - val grouped = allModules.groupBy(m => - if (m.organization == "com.typesafe.akka" || m.organization.startsWith("com.lightbend.akka")) { + val grouped = allModules + .filter(m => m.organization == "com.typesafe.akka" || m.organization.startsWith("com.lightbend.akka")) + .groupBy{m => val nameWithoutScalaV = m.name.replaceFirst("(_2\\.\\d\\d|_3)$", "") if (coreModules(nameWithoutScalaV)) Akka else if (akkaHttpModules(nameWithoutScalaV)) AkkaHttp else if (akkaManagementModules(nameWithoutScalaV)) AkkaManagement else Others } - ) val akkaVersion = grouped.get(Akka) .flatMap(verifyVersions("Akka", _, updateReport)) .map(VersionNumber.apply)