Skip to content

Scalafix 0.3.0

Compare
Choose a tag to compare
@olafurpg olafurpg released this 11 Sep 17:17
· 3813 commits to main since this release
  • Scalafix now uses the scala.meta semantic API! See scala.meta 1.6 release notes for more details about the semantic api. This first release of the scala.meta semantic API enables rules to query for the "symbol" of a name that appears in a Scala source file. A symbol is a unique identifier of a definition such as a class, val, def or trait.

  • To demonstrate the capabilities of rules using the scala.meta semantic API, we have included an example rule called Xor2Either. The rule migrates usage of cats.data.Xor to scala.util.Either.

  • Rules can now be implemented in terms of "tree patches", which are high level descriptions of common refactoring operations. Tree patches can be composed to build more advanced refactorings such as Xor2Either. The current available tree patches are

    • Replace: Replaces usage of a symbol with another name.
    • AddGlobalImport: Adds a top-level import to source file.
    • RemoveGlobalImport: Removes a top-level import from source file.

    Special thanks go to @ShaneDelmore for helping out try the scalafix patch API at every step of its development. His feedback has been invaluable in improving the design of the API.

  • Configuration in .scalafix.conf has been greatly improved to support a wide range of options. Examples, see patches, imports (now removed) and All options (removed).