Skip to content

Commit

Permalink
Merge pull request #2053 from scalacenter/docs-proceduresyntax
Browse files Browse the repository at this point in the history
Scala 3 docs tweaks
  • Loading branch information
bjaglin authored Aug 25, 2024
2 parents fa08c69 + 597ba16 commit 7252d3e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 27 deletions.
6 changes: 1 addition & 5 deletions docs/developers/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ following sbt settings
The only requirement is that the input project uses a Scala compiler version
that is either supported by
[SemanticDB](https://scalameta.org/docs/semanticdb/specification.html) compiler
plugin or built-in in the compiler. Supported Scala compiler versions include:

- Scala @SCALA212@
- Scala @SCALA213@
- Scala 3.x
plugin or built-in in the compiler.

The output project can use any Scala compiler version.

Expand Down
1 change: 0 additions & 1 deletion docs/rules/ProcedureSyntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ trait A { def doSomething: Unit }
```

This syntax no longer exists in Scala 3 and therefore this rule only makes sense in Scala 2.
You need to remove `ProcedureSyntax` from `.scalafix.conf` for Scala 3 projects.
4 changes: 2 additions & 2 deletions docs/users/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Scalafix is tested to work with:

* **macOS, Linux or Windows**
* **Java LTS (8, 11, 17 or 21)**
* **Scala @SCALA212@, @SCALA213@ or @SCALA3LTS@ LTS or @SCALA3NEXT@**
* **Scala @SCALA212@, @SCALA213@, @SCALA3LTS@ LTS or @SCALA3NEXT@**

Note that other setups may work, but could result in unexpected behavior.

Expand Down Expand Up @@ -270,7 +270,7 @@ Central. To install a custom rule, add it to `scalafixDependencies`
```scala
// at the top of build.sbt
ThisBuild / scalafixDependencies +=
"ch.epfl.scala" %% "example-scalafix-rule" % "3.0.0"
"ch.epfl.scala" %% "example-scalafix-rule" % "4.0.0"
```

Start sbt and type `scalafix <TAB>`, once the `example-scalafix-rule` dependency
Expand Down
10 changes: 2 additions & 8 deletions scalafix-docs/src/main/scala/docs/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,8 @@ sidebar_label: Guide
.withSiteVariables(
Map(
"SEMANTICDB" -> "[SemanticDB](https://scalameta.org/docs/semanticdb/specification.html)",
"SCALA3NEXT" -> Versions.scala3Next
.split('.')
.take(2)
.mkString("", ".", ".x"),
"SCALA3LTS" -> Versions.scala3LTS
.split('.')
.take(2)
.mkString("", ".", ".x"),
"SCALA3NEXT" -> Versions.scala3Next,
"SCALA3LTS" -> Versions.scala3LTS,
"SCALA213" -> Versions.scala213,
"SCALA212" -> Versions.scala212,
"NIGHTLY_VERSION" -> Versions.version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,13 @@ import scala.meta.tokens.Token
import scala.meta.tokens.Token.Equals
import scala.meta.tokens.Token.RightParen

import metaconfig.Configured
import scalafix.util.Trivia
import scalafix.v1._

class ProcedureSyntax extends SyntacticRule("ProcedureSyntax") {

override def description: String =
"Replaces deprecated procedure syntax with explicit ': Unit ='"

override def withConfiguration(config: Configuration): Configured[Rule] = {
if (config.scalaVersion.startsWith("3"))
Configured.error(
"This rule is specific to Scala 2, since procedure syntax is not supported in Scala 3. " +
"To fix this error, remove ProcedureSyntax from .scalafix.conf"
)
else Configured.ok(this)
}
"Replaces deprecated Scala 2.x procedure syntax with explicit ': Unit ='"

override def isRewrite: Boolean = true

Expand Down

0 comments on commit 7252d3e

Please sign in to comment.