Skip to content

Commit 29ec22c

Browse files
authored
WIP Update 0.4 changelog. (#171)
Update 0.4 changelog.
1 parent 3418408 commit 29ec22c

File tree

8 files changed

+75
-28
lines changed

8 files changed

+75
-28
lines changed

readme/Changelog04.scalatex

+27-8
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,37 @@
33
@import scalafix.Versions
44

55
@sect{0.4.0}
6-
NOTE. Has not been released yet, this changelog is a work-in-progress.
6+
NOTE. This version has not been released yet, this changelog is a work-in-progress.
77
@p
8-
This release is almost a full re-write amount of changes from the 0.3.x series.
9-
A majority of the codebase has been rewritten to take full advantage
10-
of the latest @lnk("Scalameta semantic API", "https://github.com/scalameta/scalameta/blob/master/changelog/1.8.0.md").
11-
The changes affect all Scalafix modules: core (patch, rewrite api), command
12-
line interface and sbt plugin.
8+
This release is almost a full rewrite of the 0.3 Scalafix codebase.
9+
The main motivation for this change is to take full advantage
10+
of what the @lnk("Scalameta semantic API", "https://github.com/scalameta/scalameta/blob/master/changelog/1.8.0.md")
11+
offers.
1312

1413
@h4{New features}
1514

1615
@ul
1716
@li
18-
19-
17+
New rewrite @sect.ref{RemoveUnusedImports}, by @user{olafurpg}.
18+
@li
19+
New rewrite @sect.ref{RemoveXmlLiterals}, by @user{allanrenucci}.
20+
@li
21+
New rewrite @sect.ref{NoAutoTupling}, by @user{gabro}.
22+
@li
23+
New rewrite @sect.ref{ExplicitUnit}, by @user{gabro}.
24+
@li
25+
New @sect.ref{github:} protocol for loading rewrites, by @user{gabro}.
26+
@li
27+
Improved @sect.ref{scalafix-testkit}, by @user{olafurpg}.
28+
@li
29+
Simplified Rewrite API. The public API has shrunk down to
30+
four types: @code{Rewrite}, @code{Patch}, @code{ScalafixConfig} and
31+
@code{RewriteCtx}. The type parameters on @code{Rewrite} and @code{RewriteCtx}
32+
have been removed. A single @code{import scalafix._} is enough get
33+
started with rewrites.
34+
@li
35+
See the
36+
@lnk("Scalameta Semantic API", "https://github.com/scalameta/scalameta/blob/master/changelog/1.8.0.md").
2037

2138
@h4{Breaking changes}
2239

@@ -74,6 +91,8 @@
7491
The following configuration options have been removed
7592
@hl.scala
7693
imports.removeUnusedImports // replaced by RemoveUnusedImports rewrite.
94+
95+
// These were wishful thinking, too eagerly merged.
7796
imports.organizeImports
7897
imports.expandRelative
7998
imports.groupByPrefix

readme/Configuration.scalatex

+29-9
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,41 @@
1818
rewrites = [ProcedureSyntax] # No rewrites are run if empty.
1919

2020
@sect{Custom rewrites}
21-
@config
22-
rewrites = [
23-
"file:readme/MyRewrite.scala" // from local file
24-
// from url
25-
"https://gist.githubusercontent.com/olafurpg/fc6f43a695ac996bd02000f45ed02e63/raw/80218434edb85120a9c6fd6533a4418118de8ba7/ExampleRewrite.scala"
26-
// from fully qualified name on classpath
27-
"scala:scalafix.rewrite.ProcedureSyntax"
28-
]
21+
Scalafix supports loading rewrites from a few different
22+
URI protocols.
23+
24+
@sect{scala:}
25+
If a rewrites is on the classpath, you can classload it with the
26+
@code{scala:} protocol.
27+
@config
28+
rewrite = "scala:scalafix.rewrite.ProcedureSyntax"
29+
30+
@sect{file:}
31+
If a rewrites is written in a single file on disk, you can load it
32+
with the @code{file:} protocol.
33+
@config
34+
rewrite = "file:readme/MyRewrite.scala" // from local file
35+
36+
@sect{http:}
37+
If a rewrite is written in a single source file on the internet,
38+
you can load it with the @code{https:} or @code{http:} protocol
39+
@config
40+
rewrite = "https://gist.githubusercontent.com/olafurpg/fc6f43a695ac996bd02000f45ed02e63/raw/80218434edb85120a9c6fd6533a4418118de8ba7/ExampleRewrite.scala"
41+
42+
@sect{github:}
43+
If a rewrite is written in a single file and you want a short syntax,
44+
you can use the @code{github:} protocol for sharing your rewrite
45+
46+
@hl.scala
47+
// expands into @githubSyntax("org/repo/1.0.0")
48+
rewrite = "github:org/repo/1.0.0"
2949

3050
@sect{patches}
3151
For simple use-cases, it's possible to write custom rewrites directly
3252
.scalafix.conf.
3353
@config
3454
patches.removeGlobalImports = [
35-
"scala.collection.mutable" # scala.meta.Importee
55+
"scala.collection.mutable" // scala.meta.Importee
3656
]
3757
patches.addGlobalImports = [
3858
"scala.collection.immutable"

readme/Faq.scalatex

+3-7
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@
33

44
@sect{FAQ / Troubleshooting}
55

6-
If you have any questions, don't hesitate to ask on Gitter. @gitter
6+
If you have any questions, don't hesitate to ask on gitter @gitter.
77

88
@sect{Enclosing tree [2873] does not include tree [2872]}
9-
Scalafix requires code to compile with the scalac option @code{-Yrangepos}.
9+
Scalafix requires code to compile with the scalac option @code{-Yrangepos}.
1010
A macro that emits invalid tree positions is usually the cause of
1111
compiler errors triggered by @code{-Yrangepos}.
1212
Other tools like the presentation compiler (ENSIME) or
13-
scala.meta semantic api also require @code{-Yrangepos} to work properly.
13+
Scalameta Semantic API also require @code{-Yrangepos} to work properly.
1414

1515
@sect{sbt.Init$RuntimeUndefined: References to undefined settings at runtime.}
1616
You might be using an old version of sbt.
1717
sbt-scalafix requires sbt 0.13.13 or higher.
1818

19-
@sect{(root/compile:compileIncremental) java.lang.reflect.InvocationTargetException}
20-
You might have a typo in @code{.scalafix.conf},
21-
run @code{last root/compile:compileIncremental} to see the full stack trace.
22-

readme/Footer.scalatex

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import Main._
22
@import scalafix.Readme._
33

4+
@raw{<a href="https://github.com/you"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>}
45
@comment
56
<script>
67
function closeSidebar() {

readme/Intro.scalatex

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020

2121
@ul
2222
@li
23-
October 24 2016: Read the v0.1 release announcement @br @lnk{http://www.scala-lang.org/blog/2016/10/24/scalafix.html}
23+
May 3rd 2017: Move fast and refactor with scalafix: @br @lnk("https://vimeo.com/channels/flatmap2017/216469977").
2424
@li
25-
December 12 2016: See the talk about scalafix at Scala eXchange (requires login) @lnk{https://skillsmatter.com/skillscasts/9117-smooth-migrations-to-dotty-with-scalafix#video}
25+
March 2nd 2017: Refactoring with scalafix and scalameta: @br @lnk("https://www.youtube.com/watch?v=7I18pJ6orrI").
26+
@li
27+
February 27 2017: Refactor with scalafix v0.3: @br @lnk{http://www.scala-lang.org/blog/2017/02/27/scalafix-v0.3.html}.
28+
@li
29+
December 12 2016: See the talk about scalafix at Scala eXchange (requires login) @lnk{https://skillsmatter.com/skillscasts/9117-smooth-migrations-to-dotty-with-scalafix#video}.
30+
@li
31+
October 24 2016: Read the v0.1 release announcement @br @lnk{http://www.scala-lang.org/blog/2016/10/24/scalafix.html}.
2632

readme/Readme.scalatex

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import Main._
22
@import scalafix.Readme._
33

4-
@sect("scalafix - a Scala rewrite tool", scalafix.Versions.stable)
4+
@sect("Scalafix - a Scala rewrite tool", scalafix.Versions.stable)
55
@scalatex.Intro()
66
@scalatex.Installation()
77
@scalatex.Configuration()

readme/src/main/scala/scalafix/Readme.scala

+4
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ object Readme {
3232
.get
3333
highlight.scala(str)
3434
}
35+
def githubSyntax(path: String) =
36+
reflect.ScalafixCompilerDecoder.GitHubUrlRewrite
37+
.unapply(Conf.Str(s"github:$path"))
38+
.get
3539
}

scalafix-cli/src/main/scala/scalafix/cli/CliRunner.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import scala.util.Success
1919
import scala.util.Try
2020
import scala.util.control.NonFatal
2121
import scalafix.cli.termdisplay.TermDisplay
22+
import scalafix.config.Class2Hocon
2223
import scalafix.config.MetaconfigPendingUpstream._
2324
import scalafix.config.PrintStreamReporter
2425
import scalafix.config.ScalafixConfig
@@ -136,7 +137,7 @@ object CliRunner {
136137
|Database:
137138
|$database
138139
|Config:
139-
|$config
140+
|${Class2Hocon(config)}
140141
|Rewrite:
141142
|$config
142143
|""".stripMargin

0 commit comments

Comments
 (0)