Skip to content

Releases: scalacenter/scalafix

Scalafix v0.6.0-M16

24 Aug 16:32
711b9a5
Compare
Choose a tag to compare
Scalafix v0.6.0-M16 Pre-release
Pre-release

⚠️ This is an unstable and undocumented milestone release intended only for early adopters. It's recommended to stay on v0.5.10 until v0.6.0 stable is out.

  • #814 add Tree.inspect and Tree.inspectLabeled helper method for a way to explore tree structures. Thank you @MasseGuillaume for implementing this in https://github.com/masseguillaume/scalameta-structure !
  • #808 migrate the website to docusaurus, this is the first step towards improving documentation for users and rule authors.
  • #809 make further progress with the scalafix.v1 API. All builtin rules except Disable are now using the v1 API. Documentation using the new website will come soon!

Scalafix v4.0.0-M15

20 Aug 12:18
247c781
Compare
Choose a tag to compare
Scalafix v4.0.0-M15 Pre-release
Pre-release

⚠️ This is an unstable and undocumented milestone release intended only for early adopters. It's recommended to stay on v0.5.10 until v0.6.0 stable is out.

Scalafix v0.6.0-M14

09 Aug 16:00
Compare
Choose a tag to compare
Scalafix v0.6.0-M14 Pre-release
Pre-release

⚠️ This is an unstable and undocumented milestone release intended only for early adopters. It's recommended to stay on v0.5.10 until v0.6.0 stable is out.

IMPORTANT. If you are on sbt 1.1 and can't upgrade to sbt v1.2.1 then the recommended version is 0.6.0-M14-3 to work around sbt/sbt#4299 ClassCastException: sbt.internal.util.Init$SettingList.

  • #786 Upgrade to Scalameta v4.0.0-M8. This is likely one of the last milestone releases before Scalameta v4. At this time there are 5 remaining open tickets in the milestone for v4.0 https://github.com/scalameta/scalameta/milestone/26
  • #781 Support loading custom rules by their name instead of FQN. This allows custom rules to include a text file META-INF/services/scalafix.v1.Rule in resources with the FQN of the rule so that users can reference external rules by their name (for example NoVars) instead of the fully qualified class name (for example class:com.bar.NoVars).
  • #783 Add scalafix-interfaces with Java APIs for reflective invocation. This PR adds a Java module scalafix-interfaces that can be used by build tools and IDEs to invoke Scalafix using JVM reflection. The module is 8kb with no external dependencies, the documentation is available here: https://www.javadoc.io/doc/ch.epfl.scala/scalafix-interfaces/0.6.0-M14
  • scalacenter/sbt-scalafix#9 support scalafixDependencies: List[ModuleID] setting in sbt-scalafix to run external custom rewrites that are published to Maven. This feature is required for the upcoming Scala collection migration rewrites.
  • scalacenter/sbt-scalafix#8 add back sbt 0.13 support to sbt-scalafix. The last M12 release only supported sbt 0.13.

Scalafix v0.6.0-M12

18 Jul 12:54
018a55c
Compare
Choose a tag to compare
Scalafix v0.6.0-M12 Pre-release
Pre-release

NOTE. This milestone release is unstable, it is recommended to stay on v0.5.10 until all of the tickets in scalameta/scalameta/milestone/26 have been fixed.

Rule authors

The Scalameta dependency has been updated to v4.0.0-M6, see release notes.

There is a best-effort automatic rewrite to upgrade scalafix.g8 generated builds from v0.5. Full instructions are available here.

If you use SymbolMatcher.exact, make sure to update hardcoded symbols to use the new format

  • package symbols now use slash / instead of dot .
    • Before: scala.collection.immutable.List#
    • Now: scala/collection/immutable/List#
  • val symbols now use dot . without ()
    • Before: scala.package.Either().
    • Now: scala/package.Either.

Users

Please wait until v0.6 stable is out and the website has been updated to document the latest improvements.

Scalafix v0.6.0-M11

03 Jul 06:54
ff7ace7
Compare
Choose a tag to compare
Scalafix v0.6.0-M11 Pre-release
Pre-release

NOTE. This milestone release is unstable, it is recommended to stay on v0.5.10 until all of the tickets in https://github.com/scalameta/scalameta/milestone/26 have been fixed.

  • upgrade to Scalameta v4.0.0-M4, #756
  • the sbt plugin has been moved to a separate repository https://github.com/scalacenter/sbt-scalafix.
  • the sbt plugin will temporarily only work for sbt 1.0. Support for 0.13 will be re-instated before v0.6 final.
  • the sbt plugin no longer dynamically resolves and classloads scalafix artifacts, it's a "normal plugin" now.

Scalafix v0.6.0-M9

13 Jun 14:47
264a8ff
Compare
Choose a tag to compare
Scalafix v0.6.0-M9 Pre-release
Pre-release

Scalafix v0.6.0-M2

11 Apr 09:22
63c8d0d
Compare
Choose a tag to compare

NOTE. v0.6.0-M3 has been released with minor fixes.

This is the second milestone release for v0.6 that includes more architectural change in how semantic rewrites work.

⚠️ This release is still not intended for public usage yet, there are several known regressions that need to be addressed before releasing v0.6.0 stable. ⚠️

Highlights

Automatically suppress linter errors with scalafixAutoSuppressLinterErrors

Contributed by @vovapolu, funded by Scalafix Bountysource. It is difficult to introduce new linter rules into existing large codebases. Scalafix already supports the --diff and --diff-base=master options to run linters on a subset of the codebase. This feature enables users to automatically insert /* scalafix:ok */ comments next to linter violations.

// before
var x = null // ERROR, null is disallowed!

// after running scalafixAutoSuppressLinterErrors
var x = null/* scalafix:ok */ // OK, error suppressed by comment

By inserting the comment in the codebase, your team may be extra motivated to fix suppressed errors.

Disable symbol by regex

Contributed by @vovapolu, funded by Scalafix Bountysource. Previously, it was only possible to disable individual symbols with the Disable rule. Now it is possible to disable a group of symbols matching a given regex. In .scalafix.conf, configure

Disable.symbols = [
  {
    regex = {
      includes = "scala.collection.mutable.*"
      excludes = "scala.collection.mutable.ArrayBuffer"
    }
    message = "Use immutable data structures"
  }
]

This configuration will report errors on all usages of symbols from the scala.collection.mutable package excluding ArrayBuffer.

Respect @SuppressWarnings to disable rules

Contributed by @marcelocenerine. In addition to /* scalafix:off */ comments, it's now possible to suppress linter errors with @SuppressWarnings("scalafix:NoNulls") annotations. Annotations are enabled across the range of the definition they annotate.

@SuppressWarnings("scalafix:NoNulls")
def dirtyBusiness(): Unit = {
    var x = null // OK, because NoNulls rule is disabled
    ...
}
// NoNulls rule is re-enabled after dirtyBusiness() definition
var x = null // error, nulls are disabled

When mixed with /* scalafix:off */ comments, annotations take precedence.

Tab completions show rule descriptions

Contributed by @tanishiking. Now it's possible to read brief descriptions for rules when using tab completion in both sbt and zsh.

scalafix-zsh-completion

Upgrade to SemanticDB v3.7

Contributed by @olafurpg and @xeno-by, relevant for rule authors. This is the first step towards making it possible for rules to lookup full type signatures of Java and Scala signatures from the classpath of a program. This functionality is enabled thanks to

  • a comprehensive spec covering details of how Scala and Java signatures map to SemanticDB Type
  • new metacp library and command-line tool to extract SemanticDB type signatures from a classpath
  • updates to semanticdb-scalac compiler plugin to emit new type signatures

This is the result of a multiple month effort and will open many exciting use-cases for rule authors in the future, including

  • robust organize imports refactoring
  • scope-aware pretty printing
  • class hierarchy aware linting

Breaking changes

  • sbt-scalafix no longer automatically installs the semanticdb-scalac compiler plugin. This means you need to manually add the following snippet of code in your build.sbt for all projects.
addCompilerPlugin(semanticdbScalac)
scalacOptions += "-Yrangepos"
  • Code that was deprecated in v0.5.x has been removed
  • sbtfix and sbtfixTest no longer support running semantic rules. It's now only possible to run syntactic rules on *.sbt files.

Summary of pull requests

The following list is a summary of the activity since the last milestone release.

End user facing

  • #496 by olafurpg, sbt-scalafix now respects unmangedSources.in(scalafix)
  • #587 by vovapolu, make sbt-scalafix follow conventions around sbt configurations
  • #589 by olafurpg, sbt-scalafix no longer automatically instals semanticdb-scalac compiler plugin
  • #601 #669 by vovapolu, new configuration options for Disable rule
  • #611 by tanishiking, fix invalid rewrite for ProcedureSyntax
  • #616 by eed3si9n, fix bug in ProcedureSyntax rule for type params
  • #620 by marcelocenerine, Respect @SuppressWarnings to disable rules
  • #639 by tanishiking, add completion for rules description in zsh.
  • #642 by tanishiking, add completion for rules description in sbt.
  • #645 by olafurpg, sbtfix task no longer supports semantic rewriting, only syntactic
  • #646 by vovapolu, add --auto-suppress-linter-errors in cli and scalafixAutoSuppressLinterErrors task in sbt-scalafix to automatically insert /* scalafix:ok */ to suppress linter violations
  • #669 by vovapolu, add support to disable symbol via regex

Docs

  • #637 by ShaneDelmore, add link to pants scalafix usage instructions in docs
  • #667 by jiminhsieh, fix invalid scalacOption in docs.
  • #671 by jiminhsieh, fix typo in docs
  • #644 by olafurpg, remove sbtfix and semanticdb-sbt from the installation docs.
  • #654 by valencik, fix vertical alignment of comments in docs
  • #657 by tanishiking, fix typo in README

Rule author facing

  • #474 by marcelocenerine, add methods for dealing with whitespaces in patch API
  • #534 by marcelocenerine, make 'from' parameter in TokenList.slice/find inclusive

Internal

  • #509 by olafurpg, bootstrap: use scalafix in scalafix build
  • #585 by MasseGuillaume, add AppVeyor as a CI on Windows
  • #590 by olafurpg, remove deprecated APIs from v0.5.0 release
  • #595 by xeno-by, upgrade to Scalameta 3.0.0
  • #602 by xeno-by, upgrade to Scalameta 3.2.0
  • #615 by xeno-by, upgrade to Scalameta 3.3.1
  • #615 by xeno-by, upgrade to Scalameta 3.3.1
  • #618 by olafurpg, simplify ProcedureSyntax implementation
  • #633 #631 #630 by sullis, upgrade build dependencies
  • #675 by olafurpg, upgrade to scalameta 3.7.0 with default settings.
  • #677 by olafurpg, Upgrade to Scalameta v3.7.3

Thank you!

Big thanks to 11 contributors for making this release happen!

$ git shortlog -sn --no-merges v0.6.0-M1..v0.6.0-M2
    37	vovapolu
    22	Ólafur Páll Geirsson
    18	Marcelo Cenerino
     6	tanishiking24
     3	Sean Sullivan
     2	Jimin Hsieh
     2	Eugene Burmako
     1	Sam Halliday
     1	Eugene Yokota
     1	Andrew Valencik
     1	Shane Delmore

Scalafix v0.6.0-M1

14 Feb 14:26
6b7b365
Compare
Choose a tag to compare

NOTE. We recommend to stay on 0.5.10 for at least a couple more milestone releases. This milestone release is primarily intended for downstream tooling to catch up to latest changes in Scalameta v3.

This release includes the following breaking changes

We plan to release at least one more milestone release that will do more breaking changes in sbt-scalafix related to installation. We are aiming for 0 breaking changes in the rewrite/lint API.

Scalafix v0.5.10

30 Jan 13:06
7614ae2
Compare
Choose a tag to compare

v0.5.10

Previous release note: v0.5.8 / v0.5.9

This is a big release for scalafix: (7 Dec 2017 - 26 Jan 2018)

Users

Rules

Docs

Honorable mention

Did not make it due to blocking issues:

Features

Bugfixes

Rule Authors

Scalafix Developers

Scalafix v0.5.9

26 Jan 23:24
f8bb86a
Compare
Choose a tag to compare