Skip to content

Commit caedc81

Browse files
committed
Apply fmt
1 parent 345cf7b commit caedc81

File tree

4 files changed

+326
-330
lines changed

4 files changed

+326
-330
lines changed

modules/build/src/main/scala/scala/build/preprocessing/DeprecatedDirectives.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ object DeprecatedDirectives {
4343
handler.keys.flatMap(_.nameAliases)
4444

4545
private val deprecatedCombinationsAndReplacements = Map[DirectiveTemplate, WarningAndReplacement](
46-
DirectiveTemplate(Seq("lib"), None) -> keyReplacement("dep")(deprecatedWarning("lib", "dep")),
46+
DirectiveTemplate(Seq("lib"), None) -> keyReplacement("dep")(deprecatedWarning("lib", "dep")),
4747
DirectiveTemplate(Seq("libs"), None) -> keyReplacement("dep")(deprecatedWarning("libs", "dep")),
4848
DirectiveTemplate(Seq("compileOnly.lib"), None) -> keyReplacement("compileOnly.dep")(
4949
deprecatedWarning("compileOnly.lib", "compileOnly.dep")

modules/cli/src/main/scala/scala/cli/commands/shared/SharedOptions.scala

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ import scala.build.Ops.EitherOptOps
1818
import scala.build.*
1919
import scala.build.compiler.{BloopCompilerMaker, ScalaCompilerMaker, SimpleScalaCompilerMaker}
2020
import scala.build.directives.DirectiveDescription
21-
import scala.build.errors.{
22-
AmbiguousPlatformError,
23-
BuildException,
24-
ConfigDbException,
25-
Severity
26-
}
21+
import scala.build.errors.{AmbiguousPlatformError, BuildException, ConfigDbException, Severity}
2722
import scala.build.input.{Element, Inputs, ResourceDirectory, ScalaCliInvokeData}
2823
import scala.build.interactive.Interactive
2924
import scala.build.interactive.Interactive.{InteractiveAsk, InteractiveNop}
@@ -728,9 +723,7 @@ object SharedOptions {
728723
toolkitVersion: Option[String],
729724
logger: Logger
730725
): Seq[Positioned[AnyDependency]] = {
731-
if (
732-
toolkitVersion.contains("latest") || toolkitVersion.contains(Toolkit.typelevel + ":latest")
733-
)
726+
if (toolkitVersion.contains("latest") || toolkitVersion.contains(Toolkit.typelevel + ":latest"))
734727
logger.message(
735728
s"""WARNING: using 'latest' for toolkit is deprecated, use 'default' to get more stable behaviour:
736729
| --toolkit ${toolkitVersion.map(_.replace("latest", "default")).getOrElse("default")}

modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala

Lines changed: 123 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,133 +1909,133 @@ abstract class BspTestDefinitions(val scalaVersionOpt: Option[String])
19091909
}
19101910

19111911
test("actionable diagnostics on deprecated using directives") {
1912-
val inputs = TestInputs(
1913-
os.rel / "test.sc" ->
1914-
"""//> using toolkit latest
1915-
|//> using test.toolkit typelevel:latest
1916-
|
1917-
|//> using lib org.typelevel::cats-core:2.6.1
1918-
|
1919-
|object Test extends App {
1920-
| println("Hello")
1921-
|}
1922-
|""".stripMargin
1923-
)
1912+
val inputs = TestInputs(
1913+
os.rel / "test.sc" ->
1914+
"""//> using toolkit latest
1915+
|//> using test.toolkit typelevel:latest
1916+
|
1917+
|//> using lib org.typelevel::cats-core:2.6.1
1918+
|
1919+
|object Test extends App {
1920+
| println("Hello")
1921+
|}
1922+
|""".stripMargin
1923+
)
19241924

1925-
withBsp(inputs, Seq(".", "--actions=false")) { (root, localClient, remoteServer) =>
1926-
async {
1927-
val buildTargetsResp = await(remoteServer.workspaceBuildTargets().asScala)
1928-
val target = {
1929-
val targets = buildTargetsResp.getTargets.asScala.map(_.getId).toSeq
1930-
expect(targets.length == 2)
1931-
extractMainTargets(targets)
1932-
}
1925+
withBsp(inputs, Seq(".", "--actions=false")) { (root, localClient, remoteServer) =>
1926+
async {
1927+
val buildTargetsResp = await(remoteServer.workspaceBuildTargets().asScala)
1928+
val target = {
1929+
val targets = buildTargetsResp.getTargets.asScala.map(_.getId).toSeq
1930+
expect(targets.length == 2)
1931+
extractMainTargets(targets)
1932+
}
19331933

1934-
val targetUri = TestUtil.normalizeUri(target.getUri)
1935-
checkTargetUri(root, targetUri)
1934+
val targetUri = TestUtil.normalizeUri(target.getUri)
1935+
checkTargetUri(root, targetUri)
19361936

1937-
val targets = List(target).asJava
1937+
val targets = List(target).asJava
19381938

1939-
val compileResp = await {
1940-
remoteServer
1941-
.buildTargetCompile(new b.CompileParams(targets))
1942-
.asScala
1943-
}
1944-
expect(compileResp.getStatusCode == b.StatusCode.OK)
1939+
val compileResp = await {
1940+
remoteServer
1941+
.buildTargetCompile(new b.CompileParams(targets))
1942+
.asScala
1943+
}
1944+
expect(compileResp.getStatusCode == b.StatusCode.OK)
19451945

1946-
val diagnosticsParams = {
1947-
val diagnostics = localClient.diagnostics()
1948-
.filter(_.getReset == false)
1949-
expect(diagnostics.size == 3)
1950-
val params = diagnostics.head
1951-
expect(params.getBuildTarget.getUri == targetUri)
1952-
expect(
1953-
TestUtil.normalizeUri(params.getTextDocument.getUri) ==
1954-
TestUtil.normalizeUri((root / "test.sc").toNIO.toUri.toASCIIString)
1955-
)
1956-
diagnostics
1957-
}
1946+
val diagnosticsParams = {
1947+
val diagnostics = localClient.diagnostics()
1948+
.filter(_.getReset == false)
1949+
expect(diagnostics.size == 3)
1950+
val params = diagnostics.head
1951+
expect(params.getBuildTarget.getUri == targetUri)
1952+
expect(
1953+
TestUtil.normalizeUri(params.getTextDocument.getUri) ==
1954+
TestUtil.normalizeUri((root / "test.sc").toNIO.toUri.toASCIIString)
1955+
)
1956+
diagnostics
1957+
}
19581958

1959-
val diagnostics = diagnosticsParams.flatMap(_.getDiagnostics.asScala)
1960-
.sortBy(_.getRange().getEnd().getCharacter())
1961-
1962-
{
1963-
checkDiagnostic(
1964-
diagnostic = diagnostics.apply(0),
1965-
expectedMessage =
1966-
"Using `latest` is deprecated, use `default` instead",
1967-
expectedSeverity = b.DiagnosticSeverity.WARNING,
1968-
expectedStartLine = 0,
1969-
expectedStartCharacter = 10,
1970-
expectedEndLine = 0,
1971-
expectedEndCharacter = 24
1972-
)
1959+
val diagnostics = diagnosticsParams.flatMap(_.getDiagnostics.asScala)
1960+
.sortBy(_.getRange().getEnd().getCharacter())
19731961

1974-
checkScalaAction(
1975-
diagnostic = diagnostics.apply(0),
1976-
expectedActionsSize = 1,
1977-
expectedTitle = "Change to: toolkit default",
1978-
expectedChanges = 1,
1979-
expectedStartLine = 0,
1980-
expectedStartCharacter = 10,
1981-
expectedEndLine = 0,
1982-
expectedEndCharacter = 24,
1983-
expectedNewText = "toolkit default"
1984-
)
1985-
}
1962+
{
1963+
checkDiagnostic(
1964+
diagnostic = diagnostics.apply(0),
1965+
expectedMessage =
1966+
"Using `latest` is deprecated, use `default` instead",
1967+
expectedSeverity = b.DiagnosticSeverity.WARNING,
1968+
expectedStartLine = 0,
1969+
expectedStartCharacter = 10,
1970+
expectedEndLine = 0,
1971+
expectedEndCharacter = 24
1972+
)
19861973

1987-
{
1988-
checkDiagnostic(
1989-
diagnostic = diagnostics.apply(1),
1990-
expectedMessage =
1991-
"Using `latest` is deprecated, use `default` instead",
1992-
expectedSeverity = b.DiagnosticSeverity.WARNING,
1993-
expectedStartLine = 1,
1994-
expectedStartCharacter = 10,
1995-
expectedEndLine = 1,
1996-
expectedEndCharacter = 39
1997-
)
1974+
checkScalaAction(
1975+
diagnostic = diagnostics.apply(0),
1976+
expectedActionsSize = 1,
1977+
expectedTitle = "Change to: toolkit default",
1978+
expectedChanges = 1,
1979+
expectedStartLine = 0,
1980+
expectedStartCharacter = 10,
1981+
expectedEndLine = 0,
1982+
expectedEndCharacter = 24,
1983+
expectedNewText = "toolkit default"
1984+
)
1985+
}
19981986

1999-
checkScalaAction(
2000-
diagnostic = diagnostics.apply(1),
2001-
expectedActionsSize = 1,
2002-
expectedTitle = "Change to: test.toolkit typelevel:default",
2003-
expectedChanges = 1,
2004-
expectedStartLine = 1,
2005-
expectedStartCharacter = 10,
2006-
expectedEndLine = 1,
2007-
expectedEndCharacter = 39,
2008-
expectedNewText = "test.toolkit typelevel:default"
2009-
)
2010-
}
1987+
{
1988+
checkDiagnostic(
1989+
diagnostic = diagnostics.apply(1),
1990+
expectedMessage =
1991+
"Using `latest` is deprecated, use `default` instead",
1992+
expectedSeverity = b.DiagnosticSeverity.WARNING,
1993+
expectedStartLine = 1,
1994+
expectedStartCharacter = 10,
1995+
expectedEndLine = 1,
1996+
expectedEndCharacter = 39
1997+
)
20111998

2012-
{
2013-
checkDiagnostic(
2014-
diagnostic = diagnostics.apply(2),
2015-
expectedMessage =
2016-
"Using `lib` is deprecated, use `dep` instead",
2017-
expectedSeverity = b.DiagnosticSeverity.WARNING,
2018-
expectedStartLine = 3,
2019-
expectedStartCharacter = 10,
2020-
expectedEndLine = 3,
2021-
expectedEndCharacter = 44
2022-
)
1999+
checkScalaAction(
2000+
diagnostic = diagnostics.apply(1),
2001+
expectedActionsSize = 1,
2002+
expectedTitle = "Change to: test.toolkit typelevel:default",
2003+
expectedChanges = 1,
2004+
expectedStartLine = 1,
2005+
expectedStartCharacter = 10,
2006+
expectedEndLine = 1,
2007+
expectedEndCharacter = 39,
2008+
expectedNewText = "test.toolkit typelevel:default"
2009+
)
2010+
}
20232011

2024-
checkScalaAction(
2025-
diagnostic = diagnostics.apply(2),
2026-
expectedActionsSize = 1,
2027-
expectedTitle = "Change to: dep org.typelevel::cats-core:2.6.1",
2028-
expectedChanges = 1,
2029-
expectedStartLine = 3,
2030-
expectedStartCharacter = 10,
2031-
expectedEndLine = 3,
2032-
expectedEndCharacter = 44,
2033-
expectedNewText = "dep org.typelevel::cats-core:2.6.1"
2034-
)
2035-
}
2012+
{
2013+
checkDiagnostic(
2014+
diagnostic = diagnostics.apply(2),
2015+
expectedMessage =
2016+
"Using `lib` is deprecated, use `dep` instead",
2017+
expectedSeverity = b.DiagnosticSeverity.WARNING,
2018+
expectedStartLine = 3,
2019+
expectedStartCharacter = 10,
2020+
expectedEndLine = 3,
2021+
expectedEndCharacter = 44
2022+
)
2023+
2024+
checkScalaAction(
2025+
diagnostic = diagnostics.apply(2),
2026+
expectedActionsSize = 1,
2027+
expectedTitle = "Change to: dep org.typelevel::cats-core:2.6.1",
2028+
expectedChanges = 1,
2029+
expectedStartLine = 3,
2030+
expectedStartCharacter = 10,
2031+
expectedEndLine = 3,
2032+
expectedEndCharacter = 44,
2033+
expectedNewText = "dep org.typelevel::cats-core:2.6.1"
2034+
)
20362035
}
20372036
}
20382037
}
2038+
}
20392039

20402040
private def checkIfBloopProjectIsInitialised(
20412041
root: os.Path,
@@ -2099,16 +2099,16 @@ abstract class BspTestDefinitions(val scalaVersionOpt: Option[String])
20992099
}
21002100

21012101
private def checkScalaAction(
2102-
diagnostic: b.Diagnostic,
2103-
expectedActionsSize: Int,
2104-
expectedTitle: String,
2105-
expectedChanges: Int,
2106-
expectedStartLine: Int,
2107-
expectedStartCharacter: Int,
2108-
expectedEndLine: Int,
2109-
expectedEndCharacter: Int,
2110-
expectedNewText: String
2111-
) = {
2102+
diagnostic: b.Diagnostic,
2103+
expectedActionsSize: Int,
2104+
expectedTitle: String,
2105+
expectedChanges: Int,
2106+
expectedStartLine: Int,
2107+
expectedStartCharacter: Int,
2108+
expectedEndLine: Int,
2109+
expectedEndCharacter: Int,
2110+
expectedNewText: String
2111+
) = {
21122112
expect(diagnostic.getDataKind == "scala")
21132113

21142114
val gson = new com.google.gson.Gson()

0 commit comments

Comments
 (0)