Refactoring and linting tool for Scala
Upgrade to Scalameta v4.1.9.
We are happy to announce the release of Scalafix v0.9.1. Scalafix is a refactoring and linting tool for Scala.
Running Scalafix on large codebases can be up to 2x faster now. A benchmark running Scalafix on the Spark codebase (3.201 files; 103.181 lines) previously took ~50 seconds now takes ~25 seconds. For more details see https://github.com/scalacenter/scalafix/pull/898. Big thanks to @marcelocenerine for this contribution!
From #907
- Now error messages will underline the whole area of matched regex
- The relevant capture group can be specified, in case you have complicated regex's which may match on parts which aren't helpful in the error message
- scalafix errors which came from a regex match have access to the capture groups for substitution in the error messages.
Big thanks to @Jacoby6000 for this contribution!
Scalafix now runs on Java 11. Our CI additionally runs the full build on Java 11 for every PR to prevent regressions.
Previously, you needed to declare scalafixDependencies
in build.sbt to run published rules.
// before: build.sbt
scalafixDependencies in ThisBuild += "org.http4s" %% "http4s-scalafix" % "0.20.0-M3"
Now it's possible to run published rules directly from the sbt shell without updating build.sbt
> scalafix dependency:[email protected]:http4s-scalafix:0.20.0-M3
Previously, sbt-scalafix required published custom rules to be available on Maven Central. Now it's possible to publish custom rules anywhere (for example Bintray) and resolve them by updating scalafixResolvers
in build.sbt. Big thanks to @kamilkloch for implementing this feature
The new option DisableSyntax.noWhileLoops=true
will trigger Scalafix to error on the usage of while loops.
PR https://github.com/scalacenter/scalafix/pull/910 improved the reported messages for unexpected errors. Thanks to @raboof for reporting!
$ git shortlog -sn --no-merges v0.9.0..v0.9.1
Jacob Barber
Ólafur Páll Geirsson
Kamil Kloch
Marcelo Cenerino
We are excited to announce the release of Scalafix v0.9.0. Scalafix is a refactoring and linting tool for Scala.
This release includes improvements to documentation, the sbt plugin, better semantic APIs, improved support for custom rules and more.
This release has been under development since January 2018 and includes contributions from 19 contributors. Big thanks to everybody who made it possible!
Scalafix has a new website https://scalacenter.github.io/scalafix/
The Scalameta dependency has been upgraded to the newly released v4.0.0
Semantic rules can now perform more advanced code analysis thanks to improvements in the semantic API:
Denotation
) now includes richer information about the symbol's signature, annotations and visibility access.The new Scalafix semantic API was made possible thanks to recent improvements in SemanticDB.
The sbt plugin has been overhauled to address issues with the previous plugin that were reported by our users. The new sbt plugin integrates directly with Scalafix library APIs resulting in an overall more polished user experience.
scalafix
, scalafixTest
and scalafixCli
tasks have been merged into a single task: scalafix
.
scalafixTest
is now scalafix --check
scalafix
continues to work as beforescalafixCli
is no longer needed since scalafix
accepts cli flagsscalafixDependencies
setting key to install custom rules from Maven Central.Check out the installation instructions to learn more how to use the sbt plugin.
This release improves the performance of the Scalafix command-line interface and the sbt plugin. A user reported speedups from 65 minutes down to to 2 minutes when running rewrites on a large codebase after upgrading from the previous release.
There is now an official public API to programmatically invoke Scalafix from build tools or IDEs. The API is available in the module scalafix-interfaces
and it's written in Java with zero dependencies weighing a total of 12kb. The API is designed to have a stable binary interface across future releases of Scalafix. This API is used by the new sbt plugin, and is available to users who would like to integrate Scalafix with other build tools like Maven, Gradle.
To learn more about the build tools API, consult the scalafix-interfaces Javadocs.
scalafix
package into scalafix.v0
. The scalafix.v0
package will be removed when Scalafix v1.0 is released in the future.Disable
and MissingFinal
have moved to a separate project https://github.com/vovapolu/scaluzzi
ExplicitResultTypes
has been removed since it produced incorrect code.DottyKeywords
, DottyVarArgPattern
and DottyVolatileLazyVal
have been removed. Scala 3 migration rewrites will be published as a separate project so that they can evolve at a different pace than the Scalafix core APIs.sbtfix
task in the sbt plugin has been removed, use scalafix --files build.sbt --files project
instead.RemoveUnused
to validate the -Ywarn-unused-import
is enabled and in the future also to ensure that Scalafix respects SemanticDB options like -P:semanticdb:targetroot
and -P:semanticdb:exclude
.Before | Now |
---|---|
import scalafix._ |
import scalafix.v0._ |
import org.langmeta._ |
import scala.meta._ |
import scala.meta.Database |
import scalafix.v0.Database |
import scala.meta.Document |
import scalafix.v0.Document |
import scala.meta.Symbol |
import scalafix.v0.Symbol |
import scala.meta.Denotation |
import scalafix.v0.Denotation |
import scala.meta.ResolvedName |
import scalafix.v0.ResolvedName |
import scala.meta.ResolvedSymbol |
import scalafix.v0.ResolvedSymbol |
import scala.meta.Synthetic |
import scalafix.v0.Synthetic |
It is recommended to migrate rules to use the new scalafix.v1
API, which imposes further changes from scalafix.v0
:
v0 | v1 |
---|---|
|
|
|
|
|
|
|
|
|
|
Additionally, v1
rules are now loaded using JDK ServiceLoader. To make a custom rule discoverable to Scalafix, create a resource file META-INF/services/scalafix.v1.Rule
with the fully qualified name of your rule
// resource file META-INF/services/scalafix.v1.Rule
fully.qualified.MyRule
Big thanks to all 19 contributors who made this release possible
$ git shortlog -sn --no-merges v0.5.10..HEAD
Ólafur Páll Geirsson
vovapolu
Marcelo Cenerino
Guillaume Massé
tanishiking24
Sam Halliday
Eugene Burmako
Shane Delmore
Sean Sullivan
Piotr Galar
Sergii Kyryliuk
Øyvind Raddum Berg
Jimin Hsieh
Per Øyvind Kanestrøm
nicodelpiano
Joan Goyeau
Gabriele Petronella
Eugene Yokota
Andrew Valencik
It's barely been 24 hours since Scalafix https://github.com/scalacenter/scalafix/releases/tag/v0.8.0-RC1 release but a lot has happened since then :)
Disable.noUniversalEquality
to report errors for usage of ==
https://scalacenter.github.io/scalafix/docs/rules/DisableSyntax.html
-P:semanticdb:exclude
compiler option and update docs on excluding files https://scalacenter.github.io/scalafix/docs/users/installation.html
-P:semanticdb:targetroot
SemanticTree
https://scalacenter.github.io/scalafix/docs/developers/semantic-tree.html#cookbook
wrote 'stricter Scala with -Xlint, -Xfatal-warnings, and Scalafix'. I am so excited about the Scalafix 0.8.0-RC1 that came out today that I wrote a custom Scalafix rule scalafix-noinfer. #scala http://eed3si9n.com/stricter-scala-with-xlint-xfatal-warnings-and-scalafix
- Eugene Yakota (@eed3si9n) September 20, 2018
This release bumps the minor version since the signature of scalafix.v1.IdTree
has changed
// before
case class IdTree(symbol: Symbol)
// now
case class IdTree(info: SymbolInfo) { def symbol = info.symbol }
Big thanks to everybody who reported issues and contributed to this release!
We are excited to announce the release of Scalafix v0.8.0. Scalafix is a refactoring and linting tool for Scala.
This release includes improvements to documentation, the sbt plugin, better semantic APIs, improved support for custom rules and more.
This release has been under development since January 2018 and includes contributions from 19 contributors. Big thanks to everybody who made it possible!
Scalafix has a new website https://scalacenter.github.io/scalafix/
The Scalameta dependency has been upgraded to the newly released v4.0.0
Semantic rules can now perform more advanced code analysis thanks to improvements in the semantic API:
Denotation
) now includes richer information about the symbol's signature, annotations and visibility access.The new Scalafix semantic API was made possible thanks to recent improvements in SemanticDB.
The sbt plugin has been overhauled to address issues with the previous plugin that were reported by our users. The new sbt plugin integrates directly with Scalafix library APIs resulting in an overall more polished user experience.
scalafix
, scalafixTest
and scalafixCli
tasks have been merged into a single task: scalafix
.
scalafixTest
is now scalafix --check
scalafix
continues to work as beforescalafixCli
is no longer needed since scalafix
accepts cli flagsscalafixDependencies
setting key to install custom rules from Maven Central.Check out the installation instructions to learn more how to use the sbt plugin.
This release improves the performance of the Scalafix command-line interface and the sbt plugin. A user reported speedups from 65 minutes down to to 2 minutes when running rewrites on a large codebase after upgrading from the previous release.
There is now an official public API to programmatically invoke Scalafix from build tools or IDEs. The API is available in the module scalafix-interfaces
and it's written in Java with zero dependencies weighing a total of 12kb. The API is designed to have a stable binary interface across future releases of Scalafix. This API is used by the new sbt plugin, and is available to users who would like to integrate Scalafix with other build tools like Maven, Gradle.
To learn more about the build tools API, consult the scalafix-interfaces Javadocs.
scalafix
package into scalafix.v0
. The scalafix.v0
package will be removed when Scalafix v1.0 is released in the future.Disable
and MissingFinal
have moved to a separate project https://github.com/vovapolu/scaluzzi
ExplicitResultTypes
has been removed since it produced incorrect code.DottyKeywords
, DottyVarArgPattern
and DottyVolatileLazyVal
have been removed. Scala 3 migration rewrites will be published as a separate project so that they can evolve at a different pace than the Scalafix core APIs.sbtfix
task in the sbt plugin has been removed, use scalafix --files build.sbt --files project
instead.RemoveUnused
to validate the -Ywarn-unused-import
is enabled and in the future also to ensure that Scalafix respects SemanticDB options like -P:semanticdb:targetroot
and -P:semanticdb:exclude
.Before | Now |
---|---|
import scalafix._ |
import scalafix.v0._ |
import org.langmeta._ |
import scala.meta._ |
import scala.meta.Database |
import scalafix.v0.Database |
import scala.meta.Document |
import scalafix.v0.Document |
import scala.meta.Symbol |
import scalafix.v0.Symbol |
import scala.meta.Denotation |
import scalafix.v0.Denotation |
import scala.meta.ResolvedName |
import scalafix.v0.ResolvedName |
import scala.meta.ResolvedSymbol |
import scalafix.v0.ResolvedSymbol |
import scala.meta.Synthetic |
import scalafix.v0.Synthetic |
It is recommended to migrate rules to use the new scalafix.v1
API, which imposes further changes from scalafix.v0
:
v0 | v1 |
---|---|
|
|
|
|
|
|
|
|
|
|
Additionally, v1
rules are now loaded using JDK ServiceLoader. To make a custom rule discoverable to Scalafix, create a resource file META-INF/services/scalafix.v1.Rule
with the fully qualified name of your rule
// resource file META-INF/services/scalafix.v1.Rule
fully.qualified.MyRule
Big thanks to all 19 contributors who made this release possible
$ git shortlog -sn --no-merges v0.5.10..HEAD
Ólafur Páll Geirsson
vovapolu
Marcelo Cenerino
Guillaume Massé
tanishiking24
Sam Halliday
Eugene Burmako
Shane Delmore
Sean Sullivan
Piotr Galar
Sergii Kyryliuk
Øyvind Raddum Berg
Jimin Hsieh
Per Øyvind Kanestrøm
nicodelpiano
Joan Goyeau
Gabriele Petronella
Eugene Yokota
Andrew Valencik