Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
olafurpg committed Dec 9, 2016
1 parent 6f006dc commit efdbe17
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 7 deletions.
13 changes: 11 additions & 2 deletions readme/Changelog.scalatex
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
@import Main._
@import scalafix.Readme._
@sect{Changelog}
@sect{0.2.0}
@ul
@li
First semantic rewrite! See @sect.ref{ExplicitImplicit}
@li
Removed command line interface in favor of compiler plugin.
Why? To run semantic rewrites, scalafix needs to compile source files.
The scalafix command line tool has no aspiration to become a build tool.
@sect{0.1.0}
@ul
@li
New command line tool: @code{scalafix}. See @sect.ref{Command line}.
New command line tool: @code{scalafix}.
(EDIT: superseded by scalafix-nsc compiler plugin in v0.2)
@li
New SBT plugin: @code{sbt-scalafix}. See @sect.ref{SBT}.
New SBT plugin: @code{sbt-scalafix}. See @sect.ref{sbt}.
@li
Two rewrite rules:
@sect.ref{ProcedureSyntax}
Expand Down
27 changes: 24 additions & 3 deletions readme/Installation.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
@import scalafix.rewrite._

@sect{Installation}
@sect{Command line}
@comment
{Command line}
@p
There are several ways to install the command line interface.

Expand Down Expand Up @@ -50,10 +51,30 @@
to your @code{$PATH}. Feel free to name the script @code{scalafix} instead of @code{scalafix_ng}.
The script will automatically start the nailgun server if the server is turned off.

@sect{SBT}
@sect{sbt}
@hl.scala
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "@scalafix.Versions.stable")

@ul
@li
The command @code{sbt scalafix} runs all available @sect.ref{Rewrites}.
@code{sbt scalafix} runs @sect.ref{Rewrites}.
@li
Use @code{scalafixRewrites := Seq[String]} to configure which rewrites to run.
Available options can be imported from @code{scalafix.sbt.rewrite._}

@sect{Other}
Scalafix can be used directly as a compiler plugin:
@hl.scala
// download
"ch.epfl.scala" %% "scalafix-nsc" % "@scalafix.Versions.stable"
// compile
scalac -Xplugin:/path/to/scalafix-nsc.jar mycode.scala

@ul
@li
Note, the compiler plugin writes fixes directly to source files during
compilation.
@li
To configure which rewrites to run:
@code{-P:scalafix:Rewrite1,scalafix:Rewrite2}.

2 changes: 1 addition & 1 deletion readme/Intro.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@p
@raw
<a href="http://stats.lassie.io:8001/scalacenter/scalafix"><img src="http://stats.lassie.io:8001/api/badges/scalacenter/scalafix/status.svg" /></a>
<a href="http://drone.geirsson.com:8001/scalacenter/scalafix"><img src="http://drone.geirsson.com:8001/api/badges/scalacenter/scalafix/status.svg" /></a>
<a href="https://gitter.im/scalacenter/scalafix?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"><img src="https://camo.githubusercontent.com/382ebf95f5b4df9275ac203229928db8c8fd5c50/68747470733a2f2f6261646765732e6769747465722e696d2f6f6c6166757270672f7363616c61666d742e737667" alt="Join the chat at https://gitter.im/scalacenter/scalafix" data-canonical-src="https://badges.gitter.im/scalacenter/scalafix.svg" style="max-width:100%;"></a>

@p
Expand Down
4 changes: 3 additions & 1 deletion readme/Readme.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package scalafix

import scalatags.Text.TypedTag
import scalatags.Text.all._

import scalatex._
import scalatags.Text.all._

object Readme {
def note = b("Note. ")
def github: String = "https://github.com"
def repo: String = "https://github.com/scalacenter/scalafix"
def issue(i: Int): Frag = a(href := s"$repo/issues/$i", s"#$i")
def dotty = a(href := "http://dotty.epfl.ch/", "Dotty")
def comment(frags: Frag*): TypedTag[String] = span("")

}
21 changes: 21 additions & 0 deletions readme/Rewrites.scalatex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,27 @@
@p
Scalafix is a very new tool, more rewrite rules will come in future releases.

@sect(ExplicitImplicit.toString)
Dotty requires implicit @code{val}s and @code{def}s to explicitly annotate
return types.
The @ExplicitImplicit.toString rewrite inserts the inferred type from the
compiler for implicit definitions that are missing an explicit return type.
For example,

@hl.scala
// before
implicit val tt = liftedType
// after
implicit val tt: TypedType[R] = liftedType

@ul
@li
scalafix tries to minimize the inserted type signature, by using
available variable names in scope.
@li
scalafix will insert the fully qualified type name if the type
is not in scope.

@sect(ProcedureSyntax.toString)
"Procedure syntax" is not supported in Dotty.
Methods that use procedure syntax should use regular method syntax instead.
Expand Down

0 comments on commit efdbe17

Please sign in to comment.