Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fun createLoader(source: Path): ConfigurationLoader<*> {
.defaultOptions {
it.serializers { s ->
s.registerAnnotatedObjects(
ObjectMapper.factoryBuilder().addDiscoverer(dataClassFieldDiscoverer()).build(),
ObjectMapper.factoryBuilder().addDiscoverer(dataClassFieldDiscoverer()).build()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import org.spongepowered.configurate.ConfigurationOptions
/** Create a new basic configuration node, optionally providing options. */
fun node(
options: ConfigurationOptions = ConfigurationOptions.defaults(),
init: BasicConfigurationNode.() -> Unit
init: BasicConfigurationNode.() -> Unit,
): BasicConfigurationNode = BasicConfigurationNode.root<RuntimeException>(options, init)

/** Create a commented configuration node. */
fun commented(
options: ConfigurationOptions = ConfigurationOptions.defaults(),
init: CommentedConfigurationNode.() -> Unit
init: CommentedConfigurationNode.() -> Unit,
): CommentedConfigurationNode = CommentedConfigurationNode.root<RuntimeException>(options, init)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private object DataClassFieldDiscoverer : FieldDiscoverer<MutableMap<KParameter,
combinedAnnotations(
param.type.javaElement,
param.javaElement,
field.javaField
field.javaField,
), // type, backing field, etc
// deserializer
{ intermediate, arg, implicitProvider ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ operator fun <N : ConfigurationNode> ConfigurationNodeFactory<N>.invoke(
*/
fun <T : ConfigurationNode> ConfigurationNodeFactory<T>.node(
options: ConfigurationOptions = this.defaultOptions(),
init: T.() -> Unit
init: T.() -> Unit,
): T {
val ret = createNode(options)
ret.init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.spongepowered.configurate.NodePath
// TODO: Deprecated due to being added directly to class, make HIDDEN for 4.2.0
@Deprecated(
message = "This method has been added directly to NodePath",
replaceWith = ReplaceWith("this.plus(other)")
replaceWith = ReplaceWith("this.plus(other)"),
)
operator fun NodePath.plus(other: NodePath): NodePath {
return NodePath.of(
Expand All @@ -33,7 +33,7 @@ operator fun NodePath.plus(other: NodePath): NodePath {
} else {
other[it - size()]
}
},
}
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun <T : Any> TypeSerializerCollection.get(type: KClass<T>): TypeSerializer<T>?
*/
fun <A : Annotation> Builder.addProcessor(
definition: KClass<A>,
factory: Processor.Factory<A, Any?>
factory: Processor.Factory<A, Any?>,
): Builder = addProcessor(definition.java, factory)

/**
Expand Down Expand Up @@ -105,7 +105,7 @@ inline fun <reified A : Annotation, reified T : Any> Builder.addProcessor(
*/
fun <A : Annotation> Builder.addConstraint(
definition: KClass<A>,
factory: Constraint.Factory<A, Any?>
factory: Constraint.Factory<A, Any?>,
): Builder = addConstraint(definition.java, factory)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BuildersTest {
attributed(
"ServerPack",
"version" to "1.15.2",
"url" to "https://permissionsex.stellardrift.ca"
"url" to "https://permissionsex.stellardrift.ca",
) {
this.node("a").set("Hello")
this.node("Game, over").set(5)
Expand Down Expand Up @@ -69,7 +69,7 @@ private val NO_VALUE: Any = Any()
fun <N : ScopedConfigurationNode<N>> N.child(
vararg path: Any,
value: Any? = NO_VALUE,
init: N.() -> Unit = {}
init: N.() -> Unit = {},
) {
val node = this.node(*path)
if (value != NO_VALUE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ObjectMappingTest {
node {
this.node("name").set("meow")
this.node("attributes").set("quiet") // does not match regex
},
}
)
}
}
Expand All @@ -94,7 +94,7 @@ class ObjectMappingTest {
CommentedConfigurationNode.root(
ConfigurationOptions.defaults().implicitInitialization(true).serializers {
it.registerAnnotatedObjects(objectMapperFactory())
},
}
)

val tester = objectMapper<ImplicitTest>().load(node)
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ errorprone="2.27.1"
indra = "3.1.3"
junit="5.11.3"
ktlint="0.49.1"
ktfmt="0.49"
ktfmt="0.54"
pmd = "6.55.0"
spotless = "6.25.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Tool :

This helps to understand the internal structure of Configurate's nodes
"""
.trimIndent(),
.trimIndent()
) {
init {
AnsiConsole.systemInstall()
Expand Down Expand Up @@ -174,7 +174,7 @@ sealed class FormatSubcommand<N : ScopedConfigurationNode<N>>(formatName: String
SPLIT,
attributes
.map { (k, v) -> "@|green \"$k\"|@=@|green \"$v\"|@" }
.joinToString(", ")
.joinToString(", "),
)
}
}
Expand Down
Loading