Skip to content

lightbend-labs/scala-rewrites

Folders and files

NameName
Last commit message
Last commit date
Jan 27, 2025
Jun 30, 2020
Jun 30, 2020
Dec 19, 2024
Aug 17, 2023
Aug 17, 2023
May 1, 2019
Sep 3, 2020
Sep 3, 2020
Aug 16, 2023
Aug 18, 2023
Aug 16, 2023

Repository files navigation

Scalafix Rewrites for Scala

How to run the rewrites

Add the sbt-scalafix sbt plugin, with the SemanticDB compiler plugin enabled (official docs):

// project/plugins.sbt
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0")
// build.sbt
inThisBuild(List(
  semanticdbEnabled := true,
  semanticdbOptions += "-P:semanticdb:synthetics:on", // make sure to add this
  semanticdbVersion := scalafixSemanticdb.revision,
  scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value),
))

Then run the desired rewrite(s) (official docs), in sbt:

> scalafixAll dependency:fix.scala213.ExplicitNonNullaryApply@org.scala-lang:scala-rewrites:<version>

You can also add the following to your build.sbt:

ThisBuild / scalafixDependencies += "org.scala-lang" %% "scala-rewrites" % "<version>"

and then:

> scalafixAll fix.scala213.ExplicitNonNullaryApply

To develop/contribute to any of the rewrites

sbt ~tests/test
# edit rewrites/src/main/scala/...