From fd0e808eeebb8b8bfa8bd7c34bee0c823eaf3b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Wro=C5=84ski?= Date: Tue, 16 Aug 2022 21:31:19 +0800 Subject: [PATCH] Dump scalafmt to 3.5.9 in tests and doc --- .scalafmt.conf | 2 +- .../scala/scala/cli/integration/FmtTests.scala | 14 +++++++------- website/docs/commands/fmt.md | 16 ++++++++-------- website/docs/release_notes.md | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index b27d2ee023..a806248af7 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.5.8" +version = "3.5.9" align.preset = more maxColumn = 100 diff --git a/modules/integration/src/test/scala/scala/cli/integration/FmtTests.scala b/modules/integration/src/test/scala/scala/cli/integration/FmtTests.scala index e22bc13e5d..302a21d6f9 100644 --- a/modules/integration/src/test/scala/scala/cli/integration/FmtTests.scala +++ b/modules/integration/src/test/scala/scala/cli/integration/FmtTests.scala @@ -50,13 +50,13 @@ class FmtTests extends ScalaCliSuite { ) val simpleInputsWithVersionOnly: TestInputs = TestInputs( - os.rel / confFileName -> "version = \"3.5.5\"".stripMargin, + os.rel / confFileName -> "version = \"3.5.9\"".stripMargin, os.rel / "Foo.scala" -> simpleInputsUnformattedContent ) val simpleInputsWithCustomConfLocation: TestInputs = TestInputs( os.rel / "custom.conf" -> - s"""|version = "3.5.5" + s"""|version = "3.5.9" |runner.dialect = scala213 |""".stripMargin, os.rel / "Foo.scala" -> simpleInputsUnformattedContent @@ -138,11 +138,11 @@ class FmtTests extends ScalaCliSuite { test("--scalafmt-version") { simpleInputs.fromRoot { root => - os.proc(TestUtil.cli, "fmt", ".", "--scalafmt-version", "3.5.5").call(cwd = root) + os.proc(TestUtil.cli, "fmt", ".", "--scalafmt-version", "3.5.9").call(cwd = root) val confLines = os.read.lines(root / Constants.workspaceDirName / confFileName) val versionInConf = confLines(0).stripPrefix("version = ").trim val updatedContent = noCrLf(os.read(root / "Foo.scala")) - expect(versionInConf == "\"3.5.5\"") + expect(versionInConf == "\"3.5.9\"") expect(updatedContent == expectedSimpleInputsFormattedContent) } } @@ -154,7 +154,7 @@ class FmtTests extends ScalaCliSuite { val versionInConf = confLines(0).stripPrefix("version = ").trim val dialectInConf = confLines(1).stripPrefix("runner.dialect = ").trim val updatedContent = noCrLf(os.read(root / "Foo.scala")) - expect(versionInConf == "\"3.5.5\"") + expect(versionInConf == "\"3.5.9\"") expect(dialectInConf == "scala213") expect(updatedContent == expectedSimpleInputsFormattedContent) } @@ -163,13 +163,13 @@ class FmtTests extends ScalaCliSuite { test("--scalafmt-conf-str") { simpleInputsWithVersionOnly.fromRoot { root => val confStr = - s"""version = 3.5.7${System.lineSeparator}runner.dialect = scala213${System.lineSeparator}""" + s"""version = 3.5.9${System.lineSeparator}runner.dialect = scala213${System.lineSeparator}""" os.proc(TestUtil.cli, "fmt", ".", "--scalafmt-conf-str", s"$confStr").call(cwd = root) val confLines = os.read.lines(root / Constants.workspaceDirName / confFileName) val versionInConf = confLines(0).stripPrefix("version = ") val dialectInConf = confLines(1).stripPrefix("runner.dialect = ") val updatedContent = noCrLf(os.read(root / "Foo.scala")) - expect(versionInConf == "\"3.5.7\"") + expect(versionInConf == "\"3.5.9\"") expect(dialectInConf == "scala213") expect(updatedContent == expectedSimpleInputsFormattedContent) } diff --git a/website/docs/commands/fmt.md b/website/docs/commands/fmt.md index 1456452ff7..5ee753fc61 100644 --- a/website/docs/commands/fmt.md +++ b/website/docs/commands/fmt.md @@ -24,7 +24,7 @@ scala-cli fmt --check Scala CLI `fmt` command supports passing the `scalafmt` **version** and **dialect** directly from the command line, using the `--scalafmt-dialect` and `--scalafmt-version` options respectively: ``` -scala-cli fmt --scalafmt-dialect scala3 --scalafmt-version 3.5.8 +scala-cli fmt --scalafmt-dialect scala3 --scalafmt-version 3.5.9 ``` You can skip passing either of those, which will make Scala CLI infer a default value: - If a `.scalafmt.conf` file is present in the workspace and it has the field defined, the value will be read from there, unless explicitly specified with Scala CLI options. @@ -35,7 +35,7 @@ It is possible to pass the configuration as a string directly from the command l #### Example 1 ``` text title=.scalafmt.conf -version = "3.5.8" +version = "3.5.9" runner.dialect = scala212 ``` @@ -44,7 +44,7 @@ scala-cli fmt --scalafmt-dialect scala213 ``` For the setup above, `fmt` will use: -- `version="3.5.8"` from the file +- `version="3.5.9"` from the file - `dialect=scala213`, because passed `--scalafmt-dialect` option overrides dialect found in the file #### Example 2 @@ -54,11 +54,11 @@ version = "2.7.5" ``` ```bash -scala-cli fmt --scalafmt-version 3.5.8 +scala-cli fmt --scalafmt-version 3.5.9 ``` For the setup above, `fmt` will use: -- `version="3.5.8"`, because passed `--scalafmt-version` option overrides version from the file +- `version="3.5.9"`, because passed `--scalafmt-version` option overrides version from the file - `dialect=scala3`, because dialect is neither passed as an option nor is it present in the configuration file, so it is inferred based on the Scala version; the Scala version wasn't explicitly specified in the command either, so it falls back to the default Scala version - the latest one, thus the resulting dialect is `scala3`. ### Scalafmt options @@ -72,7 +72,7 @@ scala-cli fmt -F --version ``` ```text -scalafmt 3.5.8 +scalafmt 3.5.9 ``` @@ -87,7 +87,7 @@ scala-cli fmt --scalafmt-help ``` ```text -scalafmt 3.5.8 +scalafmt 3.5.9 Usage: scalafmt [options] [...] -h, --help prints this usage text @@ -105,7 +105,7 @@ would be ignored. In order to prevent that from happening, the `--respect-projec default. ```text title=.scalafmt.conf -version = "3.5.8" +version = "3.5.9" runner.dialect = scala3 project { includePaths = [ diff --git a/website/docs/release_notes.md b/website/docs/release_notes.md index 0e6fec03cb..e1322785fc 100644 --- a/website/docs/release_notes.md +++ b/website/docs/release_notes.md @@ -12,7 +12,7 @@ Scala CLI can now run the `fmt` command without a `.scalafmt.conf` file present. The Scala CLI `fmt` command now supports passing the `scalafmt` version and dialect directly from the command line, using the `--scalafmt-dialect` and `--scalafmt-version` options respectively: ``` -scala-cli fmt --scalafmt-dialect scala3 --scalafmt-version 3.5.8 +scala-cli fmt --scalafmt-dialect scala3 --scalafmt-version 3.5.9 ``` Either of those (or both) can be skipped, which will make Scala CLI infer a default value.