Skip to content

Commit

Permalink
scalafmt: enable trailing commas rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Mar 31, 2024
1 parent 62270fe commit 956ec7b
Show file tree
Hide file tree
Showing 137 changed files with 1,001 additions and 1,000 deletions.
1 change: 1 addition & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ rewrite {
stringInterpolation = true
}
sortModifiers.preset = styleGuide
trailingCommas.style = "always"
}
# Disabled in default since this operation is potentially
# dangerous if you define your own stripMargin with different
Expand Down
38 changes: 19 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ inThisBuild(List(
"olafurpg",
"Ólafur Páll Geirsson",
"olafurpg@gmail.com",
url("https://geirsson.com")
url("https://geirsson.com"),
)),
scalaVersion := scala213,
crossScalaVersions := List(scala213, scala212),
resolvers ++= Resolver.sonatypeOssRepos("releases"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
libraryDependencies ++=
List(munit.value % Test, scalacheck % Test, scalametaTestkit % Test),
testFrameworks += new TestFramework("munit.Framework")
testFrameworks += new TestFramework("munit.Framework"),
))

name := "scalafmtRoot"
Expand Down Expand Up @@ -60,9 +60,9 @@ lazy val dynamic = project.in(file("scalafmt-dynamic")).settings(
"io.get-coursier" % "interface" % "0.0.17",
"com.typesafe" % "config" % "1.4.3",
munit.value % Test,
scalametaTestkit % Test
scalametaTestkit % Test,
),
scalacOptions ++= scalacJvmOptions.value
scalacOptions ++= scalacJvmOptions.value,
).dependsOn(interfaces).dependsOn(core.jvm % "test")
.enablePlugins(BuildInfoPlugin)

Expand All @@ -79,7 +79,7 @@ lazy val interfaces = project.in(file("scalafmt-interfaces")).settings(
props.put("version", version.value)
IO.write(props, "scalafmt properties", out)
List(out)
}
},
)

lazy val sysops = crossProject(JVMPlatform).withoutSuffixFor(JVMPlatform)
Expand All @@ -95,15 +95,15 @@ lazy val sysops = crossProject(JVMPlatform).withoutSuffixFor(JVMPlatform)
Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4")
case _ => Seq()
}
}
},
)

lazy val config = crossProject(JVMPlatform).withoutSuffixFor(JVMPlatform)
.in(file("scalafmt-config")).settings(
moduleName := "scalafmt-config",
description := "Scalafmt config parsing",
scalacOptions ++= scalacJvmOptions.value,
libraryDependencies ++= Seq(metaconfig.value)
libraryDependencies ++= Seq(metaconfig.value),
).jvmSettings(libraryDependencies ++= Seq(metaconfigTypesafe.value))
// .jsSettings(
// libraryDependencies ++= Seq(
Expand All @@ -120,16 +120,16 @@ lazy val core = crossProject(JVMPlatform).in(file("scalafmt-core")).settings(
"org.scalameta" %% "mdoc-parser" % mdocV,
// scala-reflect is an undeclared dependency of fansi, see #1252.
// Scalafmt itself does not require scala-reflect.
"org.scala-lang" % "scala-reflect" % scalaVersion.value
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
),
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => Seq()
case _ => Seq(compilerPlugin(
"org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full
"org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full,
))
}
}
},
)
// .jsSettings(
// libraryDependencies ++= List(
Expand Down Expand Up @@ -171,7 +171,7 @@ lazy val cli = project.in(file("scalafmt-cli")).settings(
libraryDependencies ++= Seq(
"com.googlecode.java-diff-utils" % "diffutils" % "1.3.0",
"com.martiansoftware" % "nailgun-server" % "0.9.1",
"com.github.scopt" %% "scopt" % "4.1.0"
"com.github.scopt" %% "scopt" % "4.1.0",
),
scalacOptions ++= scalacJvmOptions.value,
Compile / mainClass := Some("org.scalafmt.cli.Cli"),
Expand All @@ -184,7 +184,7 @@ lazy val cli = project.in(file("scalafmt-cli")).settings(
nativeImageOptions ++= {
val isStatic = sys.env.get("NATIVE_IMAGE_STATIC").exists(_.toBoolean)
if (isStatic) Seq("--static") else Nil
}
},
).dependsOn(coreJVM, dynamic).enablePlugins(NativeImagePlugin)

lazy val tests = project.in(file("scalafmt-tests")).settings(
Expand All @@ -193,13 +193,13 @@ lazy val tests = project.in(file("scalafmt-tests")).settings(
// Test dependencies
"com.lihaoyi" %% "scalatags" % "0.12.0",
scalametaTestkit,
munit.value
munit.value,
),
scalacOptions ++= scalacJvmOptions.value,
javaOptions += "-Dfile.encoding=UTF8",
buildInfoPackage := "org.scalafmt.tests",
buildInfoKeys :=
Seq[BuildInfoKey]("resourceDirectory" -> (Test / resourceDirectory).value)
Seq[BuildInfoKey]("resourceDirectory" -> (Test / resourceDirectory).value),
).enablePlugins(BuildInfoPlugin).dependsOn(coreJVM, dynamic, cli)

lazy val benchmarks = project.in(file("scalafmt-benchmarks")).settings(
Expand All @@ -220,14 +220,14 @@ lazy val benchmarks = project.in(file("scalafmt-benchmarks")).settings(
"-Xss8M",
"-Xms512M",
"-Xmx2G",
"-server"
)
"-server",
),
).dependsOn(coreJVM).enablePlugins(JmhPlugin)

lazy val docs = project.in(file("scalafmt-docs")).settings(
crossScalaVersions := List(scala212),
publish / skip := true,
mdoc := (Compile / run).evaluated
mdoc := (Compile / run).evaluated,
).dependsOn(cli, dynamic).enablePlugins(DocusaurusPlugin)

val V = "\\d+\\.\\d+\\.\\d+"
Expand All @@ -252,8 +252,8 @@ lazy val buildInfoSettings: Seq[Def.Setting[_]] = Seq(
"commit" -> sys.process.Process("git rev-parse HEAD").lineStream_!.head,
"timestamp" -> System.currentTimeMillis().toString,
scalaVersion,
sbtVersion
sbtVersion,
),
buildInfoPackage := "org.scalafmt",
buildInfoObject := "Versions"
buildInfoObject := "Versions",
)
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object Dependencies {
val scalapb = Def.setting {
ExclusionRule(
organization = "com.thesamet.scalapb",
name = s"scalapb-runtime_${scalaBinaryVersion.value}"
name = s"scalapb-runtime_${scalaBinaryVersion.value}",
)
}

Expand Down
2 changes: 1 addition & 1 deletion project/Mima.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ object Mima {
ProblemFilters.exclude[Problem]("org.scalafmt.config.*"),
ProblemFilters.exclude[Problem]("org.scalafmt.internal.*"),
ProblemFilters.exclude[Problem]("org.scalafmt.rewrite.*"),
ProblemFilters.exclude[Problem]("org.scalafmt.util.*")
ProblemFilters.exclude[Problem]("org.scalafmt.util.*"),
)
}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resolvers ++= Seq(
Classpaths.sbtPluginReleases,
Resolver.sonatypeRepo("releases"),
Resolver.bintrayIvyRepo("jetbrains", "sbt-plugins")
Resolver.bintrayIvyRepo("jetbrains", "sbt-plugins"),
)

addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.2")
Expand Down
22 changes: 11 additions & 11 deletions readme/src/main/scala/org/scalafmt/readme/Adopters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,54 +14,54 @@ object Adopters {
Adopter(
"sbt",
"https://github.com/sbt/sbt",
Some("The interactive build tool for Scala")
Some("The interactive build tool for Scala"),
),
Adopter(
"scala-native",
"https://github.com/scala-native/scala-native",
Some("Your favourite language gets closer to bare metal.")
Some("Your favourite language gets closer to bare metal."),
),
Adopter("HERE", "http://here.com", None),
Adopter("Letgo", "http://letgo.com", None),
Adopter(
"Seventh Sense",
"http://7thsense.io",
Some("Predictive analytics for sales and marketing")
Some("Predictive analytics for sales and marketing"),
),
Adopter(
"Teralytics",
"http://teralytics.net",
Some("We transform raw, human activity data into valuable insights.")
Some("We transform raw, human activity data into valuable insights."),
),
Adopter(
"Venatus Media",
"https://venatusmedia.com",
Some("We represent some of the largest entertainment publishers and monetize billions of ads.")
Some("We represent some of the largest entertainment publishers and monetize billions of ads."),
),
Adopter(
"http4s",
"http://http4s.org",
Some("A minimal, idiomatic Scala interface for HTTP")
Some("A minimal, idiomatic Scala interface for HTTP"),
),
Adopter(
"Mendix",
"https://mendix.com",
Some("The fastest and easiest platform to create and continuously improve mobile and web apps at scale.")
Some("The fastest and easiest platform to create and continuously improve mobile and web apps at scale."),
),
Adopter(
"Foursquare",
"https://enterprise.foursquare.com",
Some("We use location intelligence to build meaningful consumer experiences and business solutions.")
Some("We use location intelligence to build meaningful consumer experiences and business solutions."),
),
Adopter(
"Codacy",
"https://codacy.com",
Some("Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.")
Some("Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews."),
),
Adopter(
"ZyseMe",
"https://www.zyse.me/",
Some("We use ML to predict body measurements and automate pattern creation to integrate with production, allowing companies to produce and/or sell made-to-measure garments at scale.")
)
Some("We use ML to predict body measurements and automate pattern creation to integrate with production, allowing companies to produce and/or sell made-to-measure garments at scale."),
),
)
}
Loading

0 comments on commit 956ec7b

Please sign in to comment.