Run spotless formatting (#958)

When we updated spotless's Java and Kotlin formatter, we changed the underlying
formatting rules.
However, due to spotless ratcheting, these formatting changes don't get applied unless a file
gets touched in a commit.

To avoid future PRs introducing lines of change that aren't related to the intention of the PR,
this is a one-time format of all files.
This commit is contained in:
Daniel Chao
2025-02-17 07:36:43 -08:00
committed by GitHub
parent d270829ed3
commit 28b128f86f
79 changed files with 679 additions and 682 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ class EvaluateTestsTest {
"""
.trimIndent()
),
true
true,
)
assertThat(results.moduleName).isEqualTo("text")
@@ -75,7 +75,7 @@ class EvaluateTestsTest {
"""
.trimIndent()
),
true
true,
)
assertThat(results.totalTests()).isEqualTo(1)
@@ -111,7 +111,7 @@ class EvaluateTestsTest {
"""
.trimIndent()
),
true
true,
)
assertThat(results.totalTests()).isEqualTo(1)
@@ -157,7 +157,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
Files.writeString(
@@ -172,7 +172,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
val results = evaluator.evaluateTest(path(file), false)
@@ -207,7 +207,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
Files.writeString(
@@ -222,7 +222,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
val results = evaluator.evaluateTest(path(file), false)
@@ -260,7 +260,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
Files.writeString(
@@ -275,7 +275,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
val results = evaluator.evaluateTest(path(file), false)
@@ -314,7 +314,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
Files.writeString(
@@ -329,7 +329,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
val results = evaluator.evaluateTest(path(file), false)
@@ -377,7 +377,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
evaluator.evaluateTest(path(file), false)
val expectedFile = file.parent.resolve(file.fileName.toString() + "-expected.pcf")
@@ -411,7 +411,7 @@ class EvaluateTestsTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
createExpected(file)
.writeString(

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -128,7 +128,7 @@ class PModuleTest {
moduleUri,
moduleName,
classInfo,
mapOf("name" to "Pigeon", "age" to 42, "other" to true)
mapOf("name" to "Pigeon", "age" to 42, "other" to true),
)
assertThat(pigeon2).isNotEqualTo(pigeon)

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -106,7 +106,7 @@ class PObjectTest {
val pigeon2 =
PObject(
PClassInfo.get("test", "Person", URI("repl:test")),
mapOf("name" to "Pigeon", "age" to 21)
mapOf("name" to "Pigeon", "age" to 21),
)
assertThat(pigeon2).isNotEqualTo(pigeon)
@@ -127,7 +127,7 @@ class PObjectTest {
val pigeon2 =
PObject(
PClassInfo.get("test", "Person", URI("repl:test")),
mapOf("name" to "Pigeon", "age" to 42, "other" to true)
mapOf("name" to "Pigeon", "age" to 42, "other" to true),
)
assertThat(pigeon2).isNotEqualTo(pigeon)

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@ class PcfRendererTest {
grault = Map("garply", null, "waldo", 42, "pigeon", null)
}
"""
.trimIndent()
.trimIndent(),
)
val module =

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ class PropertiesRendererTest {
"new Mapping {}",
"Set()",
"new PropertiesRenderer {}",
"new Dynamic {}"
"new Dynamic {}",
)
unsupportedValues.forEach {

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ class ReplServerTest {
listOf(
ModuleKeyFactories.standardLibrary,
ModuleKeyFactories.classPath(this::class.java.classLoader),
ModuleKeyFactories.file
ModuleKeyFactories.file,
),
listOf(ResourceReaders.environmentVariable(), ResourceReaders.externalProperty()),
mapOf("NAME1" to "value1", "NAME2" to "value2"),
@@ -72,7 +72,7 @@ class ReplServerTest {
"length()",
"getClass()",
"toString()",
"toTyped("
"toTyped(",
)
)
}
@@ -121,7 +121,7 @@ class ReplServerTest {
"getPropertyOrNull(",
"hasProperty(",
"relativePathTo(",
"toString()"
"toString()",
)
)
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ class SecurityManagersTest {
listOf(Pattern.compile("test:foo/bar")),
listOf(Pattern.compile("env:FOO_BAR")),
{ uri -> if (uri.scheme == "one") 1 else if (uri.scheme == "two") 2 else 0 },
null
null,
)
@Test
@@ -142,7 +142,7 @@ class SecurityManagersTest {
listOf(Pattern.compile("file")),
listOf(Pattern.compile("file")),
SecurityManagers.defaultTrustLevels,
rootDir
rootDir,
)
val path = rootDir.resolve("baz.pkl")
@@ -163,7 +163,7 @@ class SecurityManagersTest {
listOf(Pattern.compile("file")),
listOf(Pattern.compile("file")),
SecurityManagers.defaultTrustLevels,
rootDir
rootDir,
)
manager.checkResolveModule(Path.of("/foo/bar/baz.pkl").toUri())
@@ -185,7 +185,7 @@ class SecurityManagersTest {
listOf(Pattern.compile("file")),
listOf(Pattern.compile("file")),
SecurityManagers.defaultTrustLevels,
rootDir
rootDir,
)
val path = rootDir.resolve("../baz.pkl")
@@ -210,7 +210,7 @@ class SecurityManagersTest {
listOf(Pattern.compile("file")),
listOf(Pattern.compile("file")),
SecurityManagers.defaultTrustLevels,
rootDir
rootDir,
)
assertThrows<SecurityManagerException> {

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import org.pkl.core.util.Nullable
class ExternalReaderRuntime(
private val moduleReaders: List<ExternalModuleReader>,
private val resourceReaders: List<ExternalResourceReader>,
private val transport: MessageTransport
private val transport: MessageTransport,
) {
/** Close the runtime and its transport. */
fun close() {
@@ -96,7 +96,7 @@ class ExternalReaderRuntime(
req.requestId,
req.evaluatorId,
null,
"No module reader found for scheme " + req.uri.scheme
"No module reader found for scheme " + req.uri.scheme,
)
)
return@start
@@ -107,7 +107,7 @@ class ExternalReaderRuntime(
req.requestId,
req.evaluatorId,
reader.listElements(req.uri),
null
null,
)
)
} catch (e: Exception) {
@@ -125,7 +125,7 @@ class ExternalReaderRuntime(
req.requestId,
req.evaluatorId,
null,
"No resource reader found for scheme " + req.uri.scheme
"No resource reader found for scheme " + req.uri.scheme,
)
)
return@start
@@ -136,7 +136,7 @@ class ExternalReaderRuntime(
req.requestId,
req.evaluatorId,
reader.listElements(req.uri),
null
null,
)
)
} catch (e: Exception) {
@@ -154,7 +154,7 @@ class ExternalReaderRuntime(
req.requestId,
req.evaluatorId,
null,
"No module reader found for scheme " + req.uri.scheme
"No module reader found for scheme " + req.uri.scheme,
)
)
return@start
@@ -176,7 +176,7 @@ class ExternalReaderRuntime(
req.requestId,
req.evaluatorId,
byteArrayOf(),
"No resource reader found for scheme " + req.uri.scheme
"No resource reader found for scheme " + req.uri.scheme,
)
)
return@start
@@ -193,7 +193,7 @@ class ExternalReaderRuntime(
}
else -> throw ProtocolException("Unexpected incoming request message: $msg")
}
}
},
)
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ class RequestCapturingClient : HttpClient {
override fun <T : Any> send(
request: HttpRequest,
responseBodyHandler: HttpResponse.BodyHandler<T>
responseBodyHandler: HttpResponse.BodyHandler<T>,
): HttpResponse<T> {
this.request = request
return FakeHttpResponse()

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,7 +74,7 @@ class BaseMessagePackCodecTest {
123,
234,
listOf(PathElement("foo", true), PathElement("bar", false)),
null
null,
)
)
roundtrip(ListModulesResponse(123, 234, null, "Something dun went wrong"))
@@ -92,7 +92,7 @@ class BaseMessagePackCodecTest {
3851,
3019,
listOf(PathElement("foo", true), PathElement("bar", false)),
null
null,
)
)
roundtrip(ListResourcesResponse(3851, 3019, null, "something went wrong"))

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ class ServiceProviderTest {
uri,
"testFactoryTest",
PClassInfo.forModuleClass("testFactoryTest", uri),
mapOf("name" to "Pigeon", "age" to 40L)
mapOf("name" to "Pigeon", "age" to 40L),
)
)
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,8 +35,8 @@ class DependencyMetadataTest {
"foo" to
Dependency.RemoteDependency(
PackageUri("package://example.com/foo@0.5.3"),
Checksums("abc123")
),
Checksums("abc123"),
)
),
"https://example.com/my/source/0.5.3/blob%{path}#L%{line}-L%{endLine}",
URI("https://example.com/my/source"),
@@ -62,9 +62,9 @@ class DependencyMetadataTest {
"map" to mapOf(true to "t", false to "f"),
"dataSize" to DataSize(1.5, DataSizeUnit.GIGABYTES),
"duration" to Duration(2.9, DurationUnit.HOURS),
"pair" to Pair(1L, "1")
)
)
"pair" to Pair(1L, "1"),
),
),
),
)
private val dependencyMetadataStr =
@@ -204,7 +204,7 @@ class DependencyMetadataTest {
listOf(
PObject(
PClassInfo.get("myModule", "MyAnnotation", URI("pkl:fake")),
mapOf("pattern" to Regex(".*").toPattern())
mapOf("pattern" to Regex(".*").toPattern()),
)
),
)

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,13 +54,13 @@ class ProjectDepsTest {
CanonicalPackageUri.of("package://localhost:0/birds@0"),
Dependency.RemoteDependency(
PackageUri.create("package://localhost:0/birds@0.5.0"),
Checksums("abc123")
Checksums("abc123"),
),
CanonicalPackageUri.of("package://localhost:0/fruit@1"),
Dependency.LocalDependency(
PackageUri.create("package://localhost:0/fruit@1.1.0"),
Path.of("../fruit")
)
Path.of("../fruit"),
),
)
ProjectDeps(projectDepsMap)
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ class ProjectTest {
.trimIndent(),
URI("https://example.com/my/issues"),
listOf(Path.of("apiTest1.pkl"), Path.of("apiTest2.pkl")),
listOf("PklProject", "PklProject.deps.json", ".**", "*.exe")
listOf("PklProject", "PklProject.deps.json", ".**", "*.exe"),
)
val expectedSettings =
PklEvaluatorSettings(
@@ -73,13 +73,13 @@ class ProjectTest {
path,
null,
null,
null
null,
)
val expectedAnnotations =
listOf(
PObject(
PClassInfo.Deprecated,
mapOf("since" to "1.2", "message" to "do not use", "replaceWith" to "somethingElse")
mapOf("since" to "1.2", "message" to "do not use", "replaceWith" to "somethingElse"),
),
PObject(PClassInfo.Unlisted, mapOf()),
PObject(PClassInfo.ModuleInfo, mapOf("minPklVersion" to "0.26.0")),

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ class PathSpecParserTest {
Identifier.get("prop3"),
Identifier.get("prop2"),
Identifier.get("prop1"),
TOP_LEVEL_VALUE
TOP_LEVEL_VALUE,
)
)
@@ -98,7 +98,7 @@ class PathSpecParserTest {
"key2",
WILDCARD_PROPERTY,
"key1",
Identifier.get("prop1")
Identifier.get("prop1"),
)
)
@@ -111,7 +111,7 @@ class PathSpecParserTest {
WILDCARD_PROPERTY,
"key1",
Identifier.get("prop1"),
TOP_LEVEL_VALUE
TOP_LEVEL_VALUE,
)
)
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ class ReflectModuleTest {
"pkl:shell",
"pkl:test",
"pkl:xml",
"pkl:yaml"
"pkl:yaml",
]
)
@ParameterizedTest(name = "can reflect on {0} module")

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,9 +35,11 @@ class LongVsDoubleSpecializationTest {
fun addition() {
val result =
evaluator.evaluate(
ModuleSource.text("""
ModuleSource.text(
"""
x1 = Pair(1.0 + 2.0, 1 + 2).second
""")
"""
)
)
assertThat(result.properties["x1"]).isEqualTo(3L)
@@ -47,9 +49,11 @@ class LongVsDoubleSpecializationTest {
fun subtraction() {
val result =
evaluator.evaluate(
ModuleSource.text("""
ModuleSource.text(
"""
x1 = Pair(1.0 - 2.0, 1 - 2).second
""")
"""
)
)
assertThat(result.properties["x1"]).isEqualTo(-1L)
@@ -59,9 +63,11 @@ class LongVsDoubleSpecializationTest {
fun multiplication() {
val result =
evaluator.evaluate(
ModuleSource.text("""
ModuleSource.text(
"""
x1 = Pair(1.0 * 2.0, 1 * 2).second
""")
"""
)
)
assertThat(result.properties["x1"]).isEqualTo(2L)

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,7 +49,7 @@ class GlobResolverTest {
"baz.pkl",
"buzzy...baz.pkl",
"ted_lasso.min.pkl",
"ted_lasso.pkl.min.pkl"
"ted_lasso.pkl.min.pkl",
]
)
fun `glob match`(input: String) {
@@ -68,7 +68,7 @@ class GlobResolverTest {
"pkl",
// crosses directory boundaries
"/bar/baz.pkl",
"/baz.pkl"
"/baz.pkl",
]
)
fun `glob non-match`(input: String) {
@@ -95,13 +95,7 @@ class GlobResolverTest {
}
@ParameterizedTest
@ValueSource(
strings =
[
"/foo.pkl/bar/baz.pkl",
"//fo///ba.pkl",
]
)
@ValueSource(strings = ["/foo.pkl/bar/baz.pkl", "//fo///ba.pkl"])
fun `globstar match 2`(input: String) {
val pattern = GlobResolver.toRegexPattern("/**/*.pkl")
assertTrue(pattern.matcher(input).matches())

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,10 +29,10 @@ class ImportGraphUtilsTest {
ImportGraph(
mapOf(
fooUri to setOf(ImportGraph.Import(barUri)),
barUri to setOf(ImportGraph.Import(fooUri))
barUri to setOf(ImportGraph.Import(fooUri)),
),
// resolved URIs is not important
mapOf()
mapOf(),
)
val cycles = ImportGraphUtils.findImportCycles(graph)
assertThat(cycles).isEqualTo(listOf(listOf(fooUri, barUri)))
@@ -50,10 +50,10 @@ class ImportGraphUtilsTest {
fooUri to setOf(ImportGraph.Import(barUri)),
barUri to setOf(ImportGraph.Import(fooUri)),
bizUri to setOf(ImportGraph.Import(quxUri)),
quxUri to setOf(ImportGraph.Import(bizUri))
quxUri to setOf(ImportGraph.Import(bizUri)),
),
// resolved URIs is not important
mapOf()
mapOf(),
)
val cycles = ImportGraphUtils.findImportCycles(graph)
assertThat(cycles).isEqualTo(listOf(listOf(fooUri, barUri), listOf(bizUri, quxUri)))
@@ -71,10 +71,10 @@ class ImportGraphUtilsTest {
barUri to setOf(ImportGraph.Import(fooUri)),
fooUri to setOf(ImportGraph.Import(bizUri)),
bizUri to setOf(ImportGraph.Import(quxUri)),
quxUri to setOf()
quxUri to setOf(),
),
// resolved URIs is not important
mapOf()
mapOf(),
)
val cycles = ImportGraphUtils.findImportCycles(graph)
assertThat(cycles).isEmpty()
@@ -87,7 +87,7 @@ class ImportGraphUtilsTest {
ImportGraph(
mapOf(fooUri to setOf(ImportGraph.Import(fooUri))),
// resolved URIs is not important
mapOf()
mapOf(),
)
val cycles = ImportGraphUtils.findImportCycles(graph)
assertThat(cycles).isEqualTo(listOf(listOf(fooUri)))