Skip to content

Commit 71a7ada

Browse files
authored
Merge pull request #195 from olafurpg/docs
Update docs and add 0.4.1 changelog.
2 parents 8e58f3a + 2411c07 commit 71a7ada

File tree

7 files changed

+58
-21
lines changed

7 files changed

+58
-21
lines changed

readme/Changelog04.scalatex

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,34 @@
22
@import scalafix.Readme._
33
@import scalafix.Versions
44

5+
@sect{0.4.1}
6+
First of all, I'd like to welcome Gabriele Petronella, @user{gabro}, to the
7+
@lnk("scalafix team", "https://github.com/scalacenter/scalafix#team")! See @pr(184).
8+
9+
@ul
10+
@li
11+
New rewrite @sect.ref{NoExtendsApp}, by @user{gabro}.
12+
@li
13+
New rewrite @sect.ref{DottyVarArgPattern}, by @user{gosubpl}.
14+
@li
15+
Errors in the @sect.ref{scalafix-testkit} docs have now been fixed, by @user{taisukeoe}.
16+
@li
17+
@code{--sourceroot} is now used by scalafix-cli, @issue(176).
18+
@li
19+
@code{--sourcepath} is no longer used by scalafix-cli.
20+
@li
21+
@sect.ref{NoAutoTupling} now handles Function1 signatures,
22+
see @issue(147).
23+
@li
24+
scalafix-cli now supports @code{--include} and @code{--exclude}
25+
to filter which files get fixed. See @sect.ref{--help} for more details.
26+
@li
27+
@sect.ref{RemoveUnusedImports} now also removes unused renamed imports,
28+
see @issue(189).
29+
30+
Big thanks you everybody who contributed this release via issues, pull requests,
31+
online discussions on @gitter and and offline discussions at Scaladays Copenhagen last week!
32+
533
@sect{0.4.0}
634
@p
735
This release represents a significant milestone for Scalafix.

readme/Installation.scalatex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@
7676
./scalafix --help
7777

7878
@p
79-
Once the scalafix cli is installed, consult the help page for further usage
79+
Once the scalafix cli is installed, consult the --help page for further usage
8080
instructions
8181

82+
@sect{--help}
8283
@hl.scala(Cli.helpMessage)
8384

readme/Rewrites.scalatex

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,30 @@
4141
See @lnk("slick/slick/pulls#1736", "https://github.com/slick/slick/pull/1736")
4242
for an example diff from running @code{sbt "scalafix RemoveUnusedImports"}.
4343

44+
@p
45+
To use this rewrite:
46+
@ul
47+
@li
48+
enable @code{-Ywarn-unused-import}
49+
@li
50+
disable @code{-Xfatal-warnings}. Unfortunately, the Scala compiler
51+
does not support finer grained control over the severity level
52+
per message kind. See @metaIssue(924) for a possible workaround
53+
in the near future.
54+
55+
@hl.scala
56+
// before
57+
import scala.List
58+
import scala.collection.{immutable, mutable}
59+
object Foo { immutable.Seq.empty[Int] }
60+
61+
// before
62+
import scala.collection.immutable
63+
object Foo { immutable.Seq.empty[Int] }
64+
4465
@p
4566
@note. This rewrite does a best-effort at preserving original formatting.
46-
In some cases, the rewriten code may be formatted weirdly
67+
In some cases, the rewritten code may be formatted weirdly
4768

4869
@hl.scala
4970
// before
@@ -56,12 +77,7 @@
5677

5778
TimeoutException
5879

59-
It's recommended to use a code formatter to clean up missing or superfluous
60-
whitespace.
61-
62-
@p
63-
@note. This rewrite is new and has only been tested on a few large projects
64-
such as Slick and Scalding. Please report if you hit on buggy behavior.
80+
It's recommended to use a code formatter after running this rewrite.
6581

6682
@sect(RemoveXmlLiterals.toString)
6783
This rewrites replaces XML literals with a @code{xml""} interpolator

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ object Readme {
1919

2020
def github: String = "https://github.com"
2121
def repo: String = "https://github.com/scalacenter/scalafix"
22+
def metaRepo: String = "https://github.com/scalameta/scalameta"
2223
def user(name: String): Frag = a(href := s"$github/$name", s"@$name")
2324
def issue(i: Int): Frag = a(href := s"$repo/issues/$i", s"#$i")
25+
def metaIssue(i: Int): Frag = a(href := s"$metaRepo/issues/$i", s"#$i")
2426
def pr(i: Int): Frag = a(href := s"$repo/pulls/$i", s"#$i")
2527
def dotty = a(href := "http://dotty.epfl.ch/", "Dotty")
2628
def comment(frags: Frag*): TypedTag[String] = span("")

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ object CliRunner {
127127
for {
128128
database <- builder.resolvedMirror
129129
sourceroot <- builder.resolvedSourceroot
130-
_ <- builder.assertSourcepathIsEmpty
131130
rewrite <- builder.resolvedRewrite
132131
replace <- builder.resolvedPathReplace
133132
inputs <- builder.resolvedInputs
@@ -165,9 +164,6 @@ object CliRunner {
165164

166165
implicit val workingDirectory: AbsolutePath = common.workingPath
167166

168-
val assertSourcepathIsEmpty: Configured[Unit] =
169-
cli.sourcepath.fold(Configured.unit)(path =>
170-
ConfError.msg(s"Expected --sourcepath to be empty, was $path.").notOk)
171167
// Database
172168
private val resolvedDatabase: Configured[Database] =
173169
(classpath, sourceroot) match {

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,6 @@ case class ScalafixOptions(
6161
)
6262
@ValueDescription("entry1.jar:entry2.jar")
6363
classpath: Option[String] = None,
64-
@Hidden // TODO(olafur) remove in v0.4. This is not used.
65-
@HelpMessage(
66-
"""java.io.File.pathSeparator separated list of Scala source files OR
67-
| directories containing Scala source files""".stripMargin)
68-
@ValueDescription("File2.scala:File1.scala:src/main/scala")
69-
sourcepath: Option[String] = None,
7064
@HelpMessage(
7165
s"""Rewrite rules to run.
7266
| NOTE. rewrite.rules = [ .. ] from --config will also run""".stripMargin

scalafix-sbt/src/main/scala/scalafix/sbt/ScalafixPlugin.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ object ScalafixPlugin extends AutoPlugin {
3737
publishArtifact := false,
3838
publishMavenStyle := false, // necessary to support intransitive dependencies.
3939
scalaVersion := Versions.scala212,
40-
// libraryDependencies := Nil, // remove injected dependencies from random sbt plugins.
40+
libraryDependencies := Nil, // remove injected dependencies from random sbt plugins.
4141
libraryDependencies +=
4242
"ch.epfl.scala" % "scalafix-cli" % scalafixVersion cross CrossVersion.full
4343
)
@@ -48,8 +48,8 @@ object ScalafixPlugin extends AutoPlugin {
4848
cliWrapperClasspath := {
4949
CrossVersion.partialVersion(sbtVersion.value) match {
5050
case Some((0, x)) if x < 13 =>
51-
streams.value.log
52-
.warn("sbt-scalafix requires sbt 0.13.13 or higher.")
51+
throw new MessageOnlyException(
52+
"sbt-scalafix requires sbt 0.13.13 or higher.")
5353
case _ =>
5454
}
5555
managedClasspath.in(scalafixStub, Compile).value

0 commit comments

Comments
 (0)