From 2610e223e3c3f3b156477b64152c76dee62ac6ea Mon Sep 17 00:00:00 2001 From: Adrien Piquerez Date: Wed, 9 Aug 2023 11:36:12 +0200 Subject: [PATCH] scalafix and scalaformat --- build.sbt | 2 +- .../src/test/scala/scaladex/core/test/Values.scala | 7 ++++--- .../scala/scaladex/infra/CoursierResolver.scala | 2 +- .../scala/scaladex/infra/SonatypeClientImpl.scala | 9 ++++----- .../scaladex/server/route/api/PublishApiTests.scala | 13 +++++-------- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/build.sbt b/build.sbt index 63947aca9..0b21824aa 100644 --- a/build.sbt +++ b/build.sbt @@ -169,7 +169,7 @@ lazy val server = project "com.typesafe.akka" %% "akka-http-testkit" % V.akkaHttp % Test, "ch.megard" %% "akka-http-cors" % "1.2.0", "com.softwaremill.akka-http-session" %% "core" % "0.7.0", - "com.typesafe.akka" %% "akka-http" % V.akkaHttpVersion, + "com.typesafe.akka" %% "akka-http" % V.akkaHttp, "org.endpoints4s" %% "akka-http-server" % "7.2.0", "org.webjars" % "bootstrap-sass" % "3.4.1", "org.webjars" % "bootstrap-switch" % "3.3.4", 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 ffe3ca9e0..f74e3d489 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 @@ -245,9 +245,10 @@ object Values { } object SbtCrossProject { - val reference = Project.Reference.from("portable-scala", "sbt-crossproject") - val mavenReference = MavenReference("org.portable-scala", "sbt-scalajs-crossproject_2.12_1.0", "1.3.2") - val creationDate = Instant.ofEpochSecond(1688667180L) + val reference: Project.Reference = Project.Reference.from("portable-scala", "sbt-crossproject") + val mavenReference: MavenReference = + MavenReference("org.portable-scala", "sbt-scalajs-crossproject_2.12_1.0", "1.3.2") + val creationDate: Instant = Instant.ofEpochSecond(1688667180L) } private def contributor(login: String): GithubContributor = diff --git a/modules/infra/src/main/scala/scaladex/infra/CoursierResolver.scala b/modules/infra/src/main/scala/scaladex/infra/CoursierResolver.scala index 2442b1a7b..11b7474e3 100644 --- a/modules/infra/src/main/scala/scaladex/infra/CoursierResolver.scala +++ b/modules/infra/src/main/scala/scaladex/infra/CoursierResolver.scala @@ -15,9 +15,9 @@ import coursier.Organization import coursier.Repositories import coursier.core.Type import coursier.error.ResolutionError -import scaladex.core.service.PomResolver import coursier.maven.SbtMavenRepository import scaladex.core.model.Artifact +import scaladex.core.service.PomResolver class CoursierResolver(implicit val ec: ExecutionContext) extends PomResolver with LazyLogging { private val repositories = Seq( diff --git a/modules/infra/src/main/scala/scaladex/infra/SonatypeClientImpl.scala b/modules/infra/src/main/scala/scaladex/infra/SonatypeClientImpl.scala index 66f9283f6..df15771f1 100644 --- a/modules/infra/src/main/scala/scaladex/infra/SonatypeClientImpl.scala +++ b/modules/infra/src/main/scala/scaladex/infra/SonatypeClientImpl.scala @@ -7,7 +7,6 @@ import java.time.format.DateTimeFormatter import scala.concurrent.ExecutionContextExecutor import scala.concurrent.Future import scala.concurrent.Promise -import scala.util.Failure import scala.util.Try import scala.util.control.NonFatal @@ -71,10 +70,10 @@ class SonatypeClientImpl()(implicit val system: ActorSystem) versionParsed = versions.flatMap(SemanticVersion.parse) } yield versionParsed future.recoverWith { - case NonFatal(exception) => - logger.warn(s"failed to retrieve versions from $uri because ${exception.getMessage}") - Future.successful(Nil) - } + case NonFatal(exception) => + logger.warn(s"failed to retrieve versions from $uri because ${exception.getMessage}") + Future.successful(Nil) + } } override def getPomFile(mavenReference: Artifact.MavenReference): Future[Option[(String, Instant)]] = { diff --git a/modules/server/src/test/scala/scaladex/server/route/api/PublishApiTests.scala b/modules/server/src/test/scala/scaladex/server/route/api/PublishApiTests.scala index 4a4bcbb6d..a469ef384 100644 --- a/modules/server/src/test/scala/scaladex/server/route/api/PublishApiTests.scala +++ b/modules/server/src/test/scala/scaladex/server/route/api/PublishApiTests.scala @@ -1,7 +1,4 @@ package scaladex.server.route.api - -import java.nio.file.Path - import scala.concurrent.duration.DurationInt import akka.http.scaladsl.model.ContentTypes @@ -13,10 +10,10 @@ import org.scalatest.BeforeAndAfterEach import scaladex.core.model.Env import scaladex.core.test.MockGithubAuth import scaladex.core.test.Values._ +import scaladex.infra.CoursierResolver import scaladex.server.route.ControllerBaseSuite import scaladex.server.route.api.PublishApi import scaladex.server.service.PublishProcess -import scaladex.infra.CoursierResolver class PublishApiTests extends ControllerBaseSuite with BeforeAndAfterEach { val pomResolver = new CoursierResolver @@ -94,10 +91,10 @@ class PublishApiTests extends ControllerBaseSuite with BeforeAndAfterEach { val request = Put(s"/publish?created=$creationDate&path=$pomFile", entity).addCredentials(admin) request ~> publishApi.routes ~> check { for (artifacts <- database.getArtifacts(SbtCrossProject.reference)) - yield { - val mavenRefs = artifacts.map(_.mavenReference) - mavenRefs should contain theSameElementsAs Seq(SbtCrossProject.mavenReference) - } + yield { + val mavenRefs = artifacts.map(_.mavenReference) + mavenRefs should contain theSameElementsAs Seq(SbtCrossProject.mavenReference) + } } } }