From 39023baa6b72518ff31e946315db0e9fca473ea5 Mon Sep 17 00:00:00 2001 From: "scala-center-steward[bot]" <111975575+scala-center-steward[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 00:25:22 +0000 Subject: [PATCH 1/4] Update sbt-scalafix to 0.13.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index dbee3c769..40942b4ee 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ addSbtPlugin("io.github.irundaia" % "sbt-sassify" % "1.5.2") addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.4") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.17.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.13.0") libraryDependencies ++= Seq( "org.testcontainers" % "postgresql" % "1.20.4", From df22ad9ff910052960fd932b20bf0f5efdfa2dae Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Wed, 8 Jan 2025 10:07:50 +0100 Subject: [PATCH 2/4] Run Scalafix --- .../src/main/scala/scaladex/core/api/ProjectResponse.scala | 2 +- .../src/main/scala/scaladex/core/model/BinaryVersion.scala | 2 +- .../shared/src/main/scala/scaladex/core/model/Version.scala | 2 +- .../shared/src/test/scala/scaladex/core/test/Values.scala | 2 +- .../scala/scaladex/data/cleanup/GithubRepoExtractor.scala | 2 +- .../src/main/scala/scaladex/infra/sql/ArtifactTable.scala | 2 +- .../src/main/scala/scaladex/infra/sql/DoobieMappings.scala | 2 +- .../src/test/scala/scaladex/infra/SqlDatabaseTests.scala | 2 +- .../src/main/scala/scaladex/server/GithubAuthImpl.scala | 2 +- modules/server/src/main/scala/scaladex/server/Server.scala | 2 +- .../main/scala/scaladex/server/route/AuthenticationApi.scala | 2 +- .../server/src/main/scala/scaladex/server/route/Badges.scala | 2 +- .../src/main/scala/scaladex/server/route/ProjectPages.scala | 4 ++-- .../src/main/scala/scaladex/server/route/SearchPages.scala | 2 +- .../scala/scaladex/server/service/ArtifactConverter.scala | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/core/shared/src/main/scala/scaladex/core/api/ProjectResponse.scala b/modules/core/shared/src/main/scala/scaladex/core/api/ProjectResponse.scala index b87639d53..028fb88b8 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/api/ProjectResponse.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/api/ProjectResponse.scala @@ -1,7 +1,7 @@ package scaladex.core.api -import scaladex.core.model.Project.* import scaladex.core.model.* +import scaladex.core.model.Project.* case class ProjectResponse( organization: Organization, diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/BinaryVersion.scala b/modules/core/shared/src/main/scala/scaladex/core/model/BinaryVersion.scala index 09a118d5c..75671ea20 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/BinaryVersion.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/BinaryVersion.scala @@ -2,8 +2,8 @@ package scaladex.core.model import scaladex.core.util.Parsers -import fastparse.NoWhitespace.* import fastparse.* +import fastparse.NoWhitespace.* final case class BinaryVersion(platform: Platform, language: Language): def isValid: Boolean = platform.isValid && language.isValid diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/Version.scala b/modules/core/shared/src/main/scala/scaladex/core/model/Version.scala index 4cfb4eeb7..9a54544fa 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/Version.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/Version.scala @@ -2,8 +2,8 @@ package scaladex.core.model import scaladex.core.util.Parsers.* -import fastparse.NoWhitespace.* import fastparse.* +import fastparse.NoWhitespace.* sealed trait Version extends Ordered[Version]: def value: String diff --git a/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala b/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala index 6af425feb..9a86d5325 100644 --- a/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala +++ b/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala @@ -3,10 +3,10 @@ package scaladex.core.test import java.time.Instant import java.time.temporal.ChronoUnit +import scaladex.core.model.* import scaladex.core.model.Artifact.* import scaladex.core.model.ArtifactDependency.Scope import scaladex.core.model.Project.Settings -import scaladex.core.model.* import scaladex.core.model.search.ProjectDocument object Values: diff --git a/modules/data/src/main/scala/scaladex/data/cleanup/GithubRepoExtractor.scala b/modules/data/src/main/scala/scaladex/data/cleanup/GithubRepoExtractor.scala index f6b0cea71..fcb745bfc 100644 --- a/modules/data/src/main/scala/scaladex/data/cleanup/GithubRepoExtractor.scala +++ b/modules/data/src/main/scala/scaladex/data/cleanup/GithubRepoExtractor.scala @@ -9,10 +9,10 @@ import scala.util.matching.Regex import scaladex.core.model.Project import scaladex.infra.DataPaths +import org.json4s.* import org.json4s.JsonAST.JField import org.json4s.JsonAST.JObject import org.json4s.JsonAST.JString -import org.json4s.* import org.json4s.native.Serialization class GithubRepoExtractor(paths: DataPaths): diff --git a/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala b/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala index 0df517e27..32ef2e812 100644 --- a/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala +++ b/modules/infra/src/main/scala/scaladex/infra/sql/ArtifactTable.scala @@ -2,8 +2,8 @@ package scaladex.infra.sql import java.time.Instant -import scaladex.core.model.Artifact.* import scaladex.core.model.* +import scaladex.core.model.Artifact.* import scaladex.infra.sql.DoobieMappings.given import scaladex.infra.sql.DoobieUtils.* diff --git a/modules/infra/src/main/scala/scaladex/infra/sql/DoobieMappings.scala b/modules/infra/src/main/scala/scaladex/infra/sql/DoobieMappings.scala index 4fb4dd66b..b6b0555c3 100644 --- a/modules/infra/src/main/scala/scaladex/infra/sql/DoobieMappings.scala +++ b/modules/infra/src/main/scala/scaladex/infra/sql/DoobieMappings.scala @@ -5,8 +5,8 @@ import java.util.UUID import scala.util.Try -import scaladex.core.model.Project.* import scaladex.core.model.* +import scaladex.core.model.Project.* import scaladex.core.util.Secret import scaladex.infra.Codecs.given diff --git a/modules/infra/src/test/scala/scaladex/infra/SqlDatabaseTests.scala b/modules/infra/src/test/scala/scaladex/infra/SqlDatabaseTests.scala index b1691735c..725fd00f3 100644 --- a/modules/infra/src/test/scala/scaladex/infra/SqlDatabaseTests.scala +++ b/modules/infra/src/test/scala/scaladex/infra/SqlDatabaseTests.scala @@ -5,8 +5,8 @@ import java.util.concurrent.Executors import scala.concurrent.ExecutionContext -import scaladex.core.model.ArtifactDependency.Scope import scaladex.core.model.* +import scaladex.core.model.ArtifactDependency.Scope import scaladex.core.util.ScalaExtensions.* import scaladex.core.util.Secret diff --git a/modules/server/src/main/scala/scaladex/server/GithubAuthImpl.scala b/modules/server/src/main/scala/scaladex/server/GithubAuthImpl.scala index f0bee6467..fca26732c 100644 --- a/modules/server/src/main/scala/scaladex/server/GithubAuthImpl.scala +++ b/modules/server/src/main/scala/scaladex/server/GithubAuthImpl.scala @@ -18,9 +18,9 @@ import com.typesafe.scalalogging.LazyLogging import io.circe.Json import org.apache.pekko.actor.ActorSystem import org.apache.pekko.http.scaladsl.* +import org.apache.pekko.http.scaladsl.model.* import org.apache.pekko.http.scaladsl.model.HttpMethods.POST import org.apache.pekko.http.scaladsl.model.Uri.* -import org.apache.pekko.http.scaladsl.model.* import org.apache.pekko.http.scaladsl.model.headers.* import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal diff --git a/modules/server/src/main/scala/scaladex/server/Server.scala b/modules/server/src/main/scala/scaladex/server/Server.scala index 49d4ea001..dd3bdeaad 100644 --- a/modules/server/src/main/scala/scaladex/server/Server.scala +++ b/modules/server/src/main/scala/scaladex/server/Server.scala @@ -31,8 +31,8 @@ import doobie.util.ExecutionContexts import org.apache.pekko.actor.ActorSystem import org.apache.pekko.http.scaladsl.* import org.apache.pekko.http.scaladsl.model.StatusCodes -import org.apache.pekko.http.scaladsl.server.Directives.* import org.apache.pekko.http.scaladsl.server.* +import org.apache.pekko.http.scaladsl.server.Directives.* object Server extends LazyLogging: diff --git a/modules/server/src/main/scala/scaladex/server/route/AuthenticationApi.scala b/modules/server/src/main/scala/scaladex/server/route/AuthenticationApi.scala index 829c47773..a21e7e074 100644 --- a/modules/server/src/main/scala/scaladex/server/route/AuthenticationApi.scala +++ b/modules/server/src/main/scala/scaladex/server/route/AuthenticationApi.scala @@ -22,9 +22,9 @@ import com.softwaremill.pekkohttpsession.SingleValueSessionSerializer import com.softwaremill.pekkohttpsession.javadsl.InMemoryRefreshTokenStorage import com.typesafe.scalalogging.LazyLogging import org.apache.pekko.actor.ActorSystem +import org.apache.pekko.http.scaladsl.model.* import org.apache.pekko.http.scaladsl.model.StatusCodes.TemporaryRedirect import org.apache.pekko.http.scaladsl.model.Uri.Query -import org.apache.pekko.http.scaladsl.model.* import org.apache.pekko.http.scaladsl.model.headers.Referer import org.apache.pekko.http.scaladsl.server.Directive1 import org.apache.pekko.http.scaladsl.server.Directives.* diff --git a/modules/server/src/main/scala/scaladex/server/route/Badges.scala b/modules/server/src/main/scala/scaladex/server/route/Badges.scala index 838dbca6e..67b8e9b86 100644 --- a/modules/server/src/main/scala/scaladex/server/route/Badges.scala +++ b/modules/server/src/main/scala/scaladex/server/route/Badges.scala @@ -18,8 +18,8 @@ import scaladex.core.model.Version.PreferStable import scaladex.core.service.WebDatabase import org.apache.pekko.http.scaladsl.model.StatusCodes.* -import org.apache.pekko.http.scaladsl.model.headers.CacheDirectives.* import org.apache.pekko.http.scaladsl.model.headers.* +import org.apache.pekko.http.scaladsl.model.headers.CacheDirectives.* import org.apache.pekko.http.scaladsl.server.Directives.* import org.apache.pekko.http.scaladsl.server.RequestContext import org.apache.pekko.http.scaladsl.server.Route diff --git a/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala b/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala index 2a29e4685..df426c5e1 100644 --- a/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala +++ b/modules/server/src/main/scala/scaladex/server/route/ProjectPages.scala @@ -23,10 +23,10 @@ import scaladex.view.html.notfound import scaladex.view.project.html import com.typesafe.scalalogging.LazyLogging -import org.apache.pekko.http.scaladsl.model.Uri.* import org.apache.pekko.http.scaladsl.model.* -import org.apache.pekko.http.scaladsl.server.Directives.* +import org.apache.pekko.http.scaladsl.model.Uri.* import org.apache.pekko.http.scaladsl.server.* +import org.apache.pekko.http.scaladsl.server.Directives.* class ProjectPages( env: Env, diff --git a/modules/server/src/main/scala/scaladex/server/route/SearchPages.scala b/modules/server/src/main/scala/scaladex/server/route/SearchPages.scala index f8d414137..7057a5d04 100644 --- a/modules/server/src/main/scala/scaladex/server/route/SearchPages.scala +++ b/modules/server/src/main/scala/scaladex/server/route/SearchPages.scala @@ -9,8 +9,8 @@ import scaladex.server.TwirlSupport.given import scaladex.view.search.html.searchresult import org.apache.pekko.http.scaladsl.model.Uri.* -import org.apache.pekko.http.scaladsl.server.Directives.* import org.apache.pekko.http.scaladsl.server.* +import org.apache.pekko.http.scaladsl.server.Directives.* class SearchPages(env: Env, searchEngine: SearchEngine)( using ExecutionContext diff --git a/modules/server/src/main/scala/scaladex/server/service/ArtifactConverter.scala b/modules/server/src/main/scala/scaladex/server/service/ArtifactConverter.scala index bafda0260..919bc4230 100644 --- a/modules/server/src/main/scala/scaladex/server/service/ArtifactConverter.scala +++ b/modules/server/src/main/scala/scaladex/server/service/ArtifactConverter.scala @@ -2,8 +2,8 @@ package scaladex.server.service import java.time.Instant -import scaladex.core.model.ArtifactDependency.Scope import scaladex.core.model.* +import scaladex.core.model.ArtifactDependency.Scope import scaladex.data.cleanup.* import scaladex.data.maven.ArtifactModel import scaladex.data.maven.Dependency From 6493ef7aec1256f469d293589b940cb801907800 Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Wed, 8 Jan 2025 10:14:22 +0100 Subject: [PATCH 3/4] Enable ExplicitResultTypes --- .scalafix.conf | 2 +- .../scala/scaladex/core/model/Platform.scala | 2 +- .../scala/scaladex/core/test/Values.scala | 20 +++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.scalafix.conf b/.scalafix.conf index f96eb60db..f2354a86c 100644 --- a/.scalafix.conf +++ b/.scalafix.conf @@ -1,5 +1,5 @@ rules = [ - # ExplicitResultTypes, + ExplicitResultTypes, OrganizeImports, # RemoveUnused ] diff --git a/modules/core/shared/src/main/scala/scaladex/core/model/Platform.scala b/modules/core/shared/src/main/scala/scaladex/core/model/Platform.scala index e4c55ae57..67f732ef5 100644 --- a/modules/core/shared/src/main/scala/scaladex/core/model/Platform.scala +++ b/modules/core/shared/src/main/scala/scaladex/core/model/Platform.scala @@ -69,7 +69,7 @@ case class MillPlugin(version: Version) extends Platform: case _ => false object MillPlugin: - val `0.10` = MillPlugin(Version(0, 10)) + val `0.10`: MillPlugin = MillPlugin(Version(0, 10)) given ordering: Ordering[MillPlugin] = Ordering.by(p => p.asInstanceOf[Platform]) diff --git a/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala b/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala index 9a86d5325..80e4ea463 100644 --- a/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala +++ b/modules/core/shared/src/test/scala/scaladex/core/test/Values.scala @@ -14,21 +14,21 @@ object Values: val ok: GithubStatus = GithubStatus.Ok(now) val unknown: GithubStatus = GithubStatus.Unknown(now) - val `2.6.1` = Version(2, 6, 1) + val `2.6.1`: Version = Version(2, 6, 1) val `4`: Version = Version(4) - val `2.5.0` = Version(2, 5, 0) - val `7.0.0` = Version(7, 0, 0) - val `7.1.0` = Version(7, 1, 0) - val `7.2.0-PREVIEW.1` = Version("7.2.0-PREVIEW.1") - val `7.2.0-PREVIEW.2` = Version("7.2.0-PREVIEW.2") - val `7.2.0` = Version(7, 2, 0) - val `7.3.0` = Version(7, 3, 0) + val `2.5.0`: Version = Version(2, 5, 0) + val `7.0.0`: Version = Version(7, 0, 0) + val `7.1.0`: Version = Version(7, 1, 0) + val `7.2.0-PREVIEW.1`: Version = Version("7.2.0-PREVIEW.1") + val `7.2.0-PREVIEW.2`: Version = Version("7.2.0-PREVIEW.2") + val `7.2.0`: Version = Version(7, 2, 0) + val `7.3.0`: Version = Version(7, 3, 0) val `_2.13`: BinaryVersion = BinaryVersion(Jvm, Scala.`2.13`) val `_3`: BinaryVersion = BinaryVersion(Jvm, Scala.`3`) val `_sjs1_3`: BinaryVersion = BinaryVersion(ScalaJs.`1.x`, Scala.`3`) - val `_sjs0.6_2.13` = BinaryVersion(ScalaJs.`0.6`, Scala.`2.13`) - val `_native0.4_2.13` = BinaryVersion(ScalaNative.`0.4`, Scala.`2.13`) + val `_sjs0.6_2.13`: BinaryVersion = BinaryVersion(ScalaJs.`0.6`, Scala.`2.13`) + val `_native0.4_2.13`: BinaryVersion = BinaryVersion(ScalaNative.`0.4`, Scala.`2.13`) private def contributor(login: String): GithubContributor = GithubContributor(login, "", Url(""), 1) From 97bb7f48f740c4547c758617aec63518803990dd Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Wed, 8 Jan 2025 10:14:49 +0100 Subject: [PATCH 4/4] Enable RemoveUnused --- .scalafix.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafix.conf b/.scalafix.conf index f2354a86c..c3eb2e46b 100644 --- a/.scalafix.conf +++ b/.scalafix.conf @@ -1,7 +1,7 @@ rules = [ ExplicitResultTypes, OrganizeImports, - # RemoveUnused + RemoveUnused ] ExplicitResultTypes {