From afe8a82f3f33879fcc6312cb764b23748e4b01e7 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Fri, 27 Dec 2024 12:26:42 -0800 Subject: [PATCH] Scalafmt: upgrade to v3.8.4 --- .scalafmt.conf | 2 +- build.sbt | 2 +- .../org/scalafmt/sbt/ScalafmtPlugin.scala | 26 +++++++++---------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 80698b6..a5e537e 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.8.3 +version = 3.8.4 runner.dialect = scala213 project { git = true diff --git a/build.sbt b/build.sbt index 7dba0b7..9ef198d 100644 --- a/build.sbt +++ b/build.sbt @@ -40,7 +40,7 @@ inThisBuild(List( )) publish / skip := true -val scalafmtVersion = "3.8.3" +val scalafmtVersion = "3.8.4" onLoadMessage := s"Welcome to sbt-scalafmt ${version.value} (scalafmt $scalafmtVersion)" diff --git a/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala b/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala index fe6b313..cebfd1a 100644 --- a/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala +++ b/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala @@ -84,12 +84,12 @@ object ScalafmtPlugin extends AutoPlugin { import sjsonnew.IsoLList import sjsonnew.LList import sjsonnew.LNil - implicit val analysisIso: IsoLList.Aux[ScalafmtAnalysis, Set[File] :*: LNil] = - LList.iso( - (a: ScalafmtAnalysis) => - ("failedScalafmtCheck", a.failedScalafmtCheck) :*: LNil, - (in: Set[File] :*: LNil) => ScalafmtAnalysis(in.head), - ) + implicit val analysisIso + : IsoLList.Aux[ScalafmtAnalysis, Set[File] :*: LNil] = LList.iso( + (a: ScalafmtAnalysis) => + ("failedScalafmtCheck", a.failedScalafmtCheck) :*: LNil, + (in: Set[File] :*: LNil) => ScalafmtAnalysis(in.head), + ) } private val scalafmtDoFormatOnCompile = @@ -146,9 +146,8 @@ object ScalafmtPlugin extends AutoPlugin { private val scalafmtSession = { val repositories = resolvers.collect { case r: MavenRepository => r.root } val repoCredentials = credentials.flatMap { c => - Try(Credentials.toDirect(c)).toOption.map { dc => - new RepositoryCredential(dc.host, dc.userName, dc.passwd) - } + Try(Credentials.toDirect(c)).toOption + .map(dc => new RepositoryCredential(dc.host, dc.userName, dc.passwd)) } log.debug(repositories.mkString("Adding repositories [", ",", "]")) @@ -467,8 +466,8 @@ object ScalafmtPlugin extends AutoPlugin { if (scalafmtOnCompile.value) resolvedScoped.value.scope / scalafmt else Def.task(()) }.value, - Compile / sources := (Compile / sources) - .dependsOn(scalafmtDoFormatOnCompile).value, + Compile / sources := (Compile / sources).dependsOn(scalafmtDoFormatOnCompile) + .value, scalafmtOnly := { val files = spaceDelimited("").parsed val absFiles = files.flatMap { fileS => @@ -503,9 +502,8 @@ object ScalafmtPlugin extends AutoPlugin { ScopeFilter(configurations = inAnyConfiguration) override def projectSettings: Seq[Def.Setting[_]] = - Seq(Compile, Test, IntegrationTest).flatMap { - inConfig(_)(scalafmtConfigSettings) - } ++ Seq( + Seq(Compile, Test, IntegrationTest) + .flatMap(inConfig(_)(scalafmtConfigSettings)) ++ Seq( scalafmtAll := scalafmt.?.all(anyConfigsInThisProject).value, scalafmtCheckAll := scalafmtCheck.?.all(anyConfigsInThisProject).value, )