Skip to content

Commit

Permalink
Scalafmt: upgrade to v3.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jan 13, 2025
1 parent 80c5d10 commit ea14672
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.3
version = 3.8.4
runner.dialect = scala213
project {
git = true
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Expand Down
26 changes: 12 additions & 14 deletions plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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 [", ",", "]"))
Expand Down Expand Up @@ -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("<files>").parsed
val absFiles = files.flatMap { fileS =>
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit ea14672

Please sign in to comment.