@olafurpg olafurpg released this Sep 11, 2017 · 1055 commits to master since this release

Assets 2

New features for end-users

This release introduces major improvements to sbt-scalafix, scalafix-cli.

New features for rule authors

  • Ability to implement rules for sources of sbt builds, including *.sbt files. The API to write sbt rules is identical to regular Scala rules.
  • Rules can now emit lint messages with ctx.lint, see LintMessage.
  • Thanks to upstream improvements in the Scalameta v2.0 Semantic API, it is now possible to
    • query symbols of implicit arguments, implicit conversions, type parameters, .apply/.unapply and symbol signatures. This represents significant portion of the work for Scalafix v0.5 and is a major milestone for the Scalameta semantic API.
    • parse symbols signatures as scala.meta.Type, including the new Type.Method which is the "type of methods" and cannot be written in source.
  • Rule.init(config): Configured[Rule] allows rules to load the user configuration during rule construction. Before, rules had to parse the configuration while fixing each individual file.
  • PatchOps.replaceSymbol/replaceTree, see Patch.
  • PatchOps now has docstrings!
  • Rules can have multiple names with optional deprecation warnings.

Bug fixes / Improvements

  • ExplicitResultTypes produces valid type signatures in a lot more cases than before. Note that it still has some known bugs, see #324.
  • More robust classloading to invoke scalafix in sbt-scalafix. Previously, sbt-scalafix used synthetic projects which cause problem in some multi-module builds. Now, sbt-scalafix uses Coursier instead.
  • Improved dynamic compilation of custom rules while running from multi-module sbt builds.
  • Extension methods now resolve to the correct symbol. For example, head in Array[Int].head previously resolved to Predef.intArrayOps and now it resolves to IndexedSeqOptimized.head.
  • scalafix-cli automatically infers whether passed --rewrites are semantic or syntactic. This means it's possible to run custom syntactic rules from scalafix-cli without passing in --classpath.

Breaking changes

From 0.5 onwards, our CI will check binary breaking changes in the public API on every pull request. Note that modules inside the package scalafix.internal don't promise binary compatibility between any releases, including PATCH upgrades.

  • github: rewrites should be inside the scalafix/rules/... directory instead of scalafix/rewrites/... directory

  • scalafix.Rewrite/SemanticRewrite is now deprecated and Mirror is now SemanticdbIndex.

    // before
    case class MyRewrite(mirror: Mirror) extends SemanticRewrite(mirror) {
      def rewrite(ctx: RewriteCtx): Patch
    // before
    case class MyRule(index: SemanticdbIndex) extends SemanticRule(index) {
      def fix(ctx: RewriteCtx): Patch
  • scalafix.testkit.SemanticRewriteSuite is now now SemanticRuleSuite.

  • scalafix.config has been moved to scalafix.internal.config. Configuration case classes break binary compatility with every new field.

  • .symbol now returns Option[Symbol] instead of Symbol. .symbolOpt has been deprecated.

  • A large number of unused methods and classes inside scalafix.internal.util.Failure, scalafix.`package` and scalafix.syntax has been removed.

  • upgraded to Scalameta 2.0, which has several breaking changes in the Tree api.

  • The VolatileLazyVal rule is now named DottyVolatileLazyVal.


git shortlog -sn --no-merges v0.4.2..v0.5.0-RC3 shows 5 people contributed to this release.

  • Ólafur Páll Geirsson
  • Gabriele Petronella
  • Guillaume Massé
  • Taisuke Oe
  • Andy Scott