Skip to content

Commit 211a076

Browse files
committed
Address feedback
1 parent 76b513f commit 211a076

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

blog/_posts/2017-02-25-scalafix-v0.3.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ by: Ólafur Páll Geirsson
55
title: "Refactor with scalafix v0.3"
66
---
77

8-
I am happy to announce the release of [scalafix v0.3][scalafix].
9-
This release uses the new scala.meta semantic API to provide a re-designed `Rewrite` and `Patch` API for refactorings.
8+
I am happy to announce the release of [scalafix v0.3][scalafix], a library and tool to rewrite Scala source code.
9+
The long-term mission of scalafix is to help automate the migration of between Scala versions.
10+
However, as I hope to demonstrate in this post, scalafix can be used for more than just migrating between Scala versions.
11+
Scalafix can also be used for ad-hoc library and application migrations.
12+
13+
Scalafix v0.3 uses the new scala.meta semantic API to provide a re-designed `Rewrite` and `Patch` API to implement custom refactorings.
1014
Let me explain what that means word by word.
1115

1216
> Note. This is the second post on scalafix and scala.meta. You might be
@@ -46,7 +50,7 @@ Example token patches are `Remove(token)` and `AddLeft(token, toAdd: String)`, w
4650

4751
Tree patches are high-level and allow rewrite author to declaratively explain what operation to perform.
4852
An example tree patch is `AddGlobalImport(importer)`, which adds a new import to the top of a file if it does not exist.
49-
Observe that `AddGlobalImport` does not worry about token-level details such as whether the user groups imports by prefix (e.g., `import a.{b, c}`).
53+
Observe that `AddGlobalImport` does not worry about token-level details such as whether the user groups imports by prefix (`import a.{b, c}`) or not (`import a.b; import a.c`).
5054

5155
Tree and token patches build a small algebra of operations that can be composed to build complex refactorings.
5256
A challenge with composing patches is to figure out what to do on conflicts.
@@ -113,10 +117,6 @@ By using scalafix as a library, you have full control of how, where and when to
113117
The recommended way to use scalafix as tool is the [`sbt-scalafix`][sbt-scalafix] plugin.
114118
It's possible define custom tree patches in the [`.scalafix.conf` configuration file][config-patches].
115119

116-
The long-term mission of scalafix is to help automate the migration of deprecated Scala 2.x features to Dotty.
117-
However, as I have demonstrated in this post, scalafix can be used for more than just migrating between Scala versions.
118-
Scalafix can also be used for ad-hoc library and application migrations.
119-
120120
I am excited to see what applications the community can build with scala.meta and scalafix.
121121
Some promising ideas that have floated around include
122122

@@ -127,6 +127,7 @@ Some promising ideas that have floated around include
127127
code-generate a version of the library that uses cats instead.
128128
- build a code search web-interface with "jump to definition" functionality
129129
powered by the scala.meta's semantic database.
130+
- replace usage of `any2stringadd` with string interpolators or explicit `.toString`.
130131
- replace usage of `scala.Seq`, which can be mutable, in favor of `scala.collection.immutable.Seq`.
131132

132133
If this sounds exciting to you, join us!

0 commit comments

Comments
 (0)