diff --git a/.editorconfig b/.editorconfig index 04a79eaa..5de3020f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,9 +6,7 @@ charset = utf-8 [*.{kt,kts}] max_line_length=120 -# Comma-separated list of rules to disable (Since 0.34.0) -# Note that rules in any ruleset other than the standard ruleset will need to be prefixed -# by the ruleset identifier. +ktlint_code_style = intellij_idea # I find trailing commas annoying ktlint_standard_trailing-comma-on-call-site = disabled diff --git a/jicoco-config/src/main/kotlin/org/jitsi/config/AbstractReadOnlyConfigurationService.kt b/jicoco-config/src/main/kotlin/org/jitsi/config/AbstractReadOnlyConfigurationService.kt index 9fd58c0a..a19536f5 100644 --- a/jicoco-config/src/main/kotlin/org/jitsi/config/AbstractReadOnlyConfigurationService.kt +++ b/jicoco-config/src/main/kotlin/org/jitsi/config/AbstractReadOnlyConfigurationService.kt @@ -35,8 +35,7 @@ abstract class AbstractReadOnlyConfigurationService : ConfigurationService { protected val logger = LoggerImpl(this::class.qualifiedName) protected abstract val properties: Properties - override fun getString(propertyName: String): String? = - getProperty(propertyName)?.toString()?.trim() + override fun getString(propertyName: String): String? = getProperty(propertyName)?.toString()?.trim() override fun getString(propertyName: String, defaultValue: String?): String? = getString(propertyName) ?: defaultValue @@ -47,17 +46,14 @@ abstract class AbstractReadOnlyConfigurationService : ConfigurationService { override fun getDouble(propertyName: String, defaultValue: Double): Double = getString(propertyName)?.toDouble() ?: defaultValue - override fun getInt(propertyName: String, defaultValue: Int): Int = - getString(propertyName)?.toInt() ?: defaultValue + override fun getInt(propertyName: String, defaultValue: Int): Int = getString(propertyName)?.toInt() ?: defaultValue override fun getLong(propertyName: String, defaultValue: Long): Long = getString(propertyName)?.toLong() ?: defaultValue - override fun getAllPropertyNames(): MutableList = - properties.keys.map { it as String }.toMutableList() + override fun getAllPropertyNames(): MutableList = properties.keys.map { it as String }.toMutableList() - override fun getProperty(propertyName: String): Any? = - properties[propertyName] ?: System.getProperty(propertyName) + override fun getProperty(propertyName: String): Any? = properties[propertyName] ?: System.getProperty(propertyName) override fun getPropertyNamesByPrefix(prefix: String, exactPrefixMatch: Boolean): MutableList { val matchingPropNames = mutableListOf() @@ -86,57 +82,43 @@ abstract class AbstractReadOnlyConfigurationService : ConfigurationService { } } - override fun getConfigurationFilename(): String = - throw Exception("Unsupported") + override fun getConfigurationFilename(): String = throw Exception("Unsupported") - override fun getScHomeDirLocation(): String = - throw Exception("Unsupported") + override fun getScHomeDirLocation(): String = throw Exception("Unsupported") - override fun getScHomeDirName(): String = - throw Exception("Unsupported") + override fun getScHomeDirName(): String = throw Exception("Unsupported") - override fun addPropertyChangeListener(listener: PropertyChangeListener?) = - throw Exception("Unsupported") + override fun addPropertyChangeListener(listener: PropertyChangeListener?) = throw Exception("Unsupported") override fun addPropertyChangeListener(propertyName: String?, listener: PropertyChangeListener?) = throw Exception("Unsupported") - override fun addVetoableChangeListener(listener: ConfigVetoableChangeListener?) = - throw Exception("Unsupported") + override fun addVetoableChangeListener(listener: ConfigVetoableChangeListener?) = throw Exception("Unsupported") override fun addVetoableChangeListener(propertyName: String?, listener: ConfigVetoableChangeListener?) = throw Exception("Unsupported") - override fun removePropertyChangeListener(listener: PropertyChangeListener?) = - throw Exception("Unsupported") + override fun removePropertyChangeListener(listener: PropertyChangeListener?) = throw Exception("Unsupported") override fun removePropertyChangeListener(propertyName: String?, listener: PropertyChangeListener?) = throw Exception("Unsupported") - override fun removeVetoableChangeListener(listener: ConfigVetoableChangeListener?) = - throw Exception("Unsupported") + override fun removeVetoableChangeListener(listener: ConfigVetoableChangeListener?) = throw Exception("Unsupported") override fun removeVetoableChangeListener(propertyName: String?, listener: ConfigVetoableChangeListener?) = throw Exception("Unsupported") - override fun purgeStoredConfiguration() = - throw Exception("Unsupported") + override fun purgeStoredConfiguration() = throw Exception("Unsupported") - override fun storeConfiguration() = - throw Exception("Unsupported") + override fun storeConfiguration() = throw Exception("Unsupported") - override fun setProperties(properties: MutableMap?) = - throw Exception("Unsupported") + override fun setProperties(properties: MutableMap?) = throw Exception("Unsupported") - override fun setProperty(propertyName: String?, property: Any?) = - throw Exception("Unsupported") + override fun setProperty(propertyName: String?, property: Any?) = throw Exception("Unsupported") - override fun setProperty(propertyName: String?, property: Any?, isSystem: Boolean) = - throw Exception("Unsupported") + override fun setProperty(propertyName: String?, property: Any?, isSystem: Boolean) = throw Exception("Unsupported") - override fun removeProperty(propertyName: String?) = - throw Exception("Unsupported") + override fun removeProperty(propertyName: String?) = throw Exception("Unsupported") - override fun getPropertyNamesBySuffix(suffix: String?): MutableList = - throw Exception("Unsupported") + override fun getPropertyNamesBySuffix(suffix: String?): MutableList = throw Exception("Unsupported") } diff --git a/jicoco-config/src/main/kotlin/org/jitsi/config/ConfigSourceWrapper.kt b/jicoco-config/src/main/kotlin/org/jitsi/config/ConfigSourceWrapper.kt index a0d7a649..28ed3e05 100644 --- a/jicoco-config/src/main/kotlin/org/jitsi/config/ConfigSourceWrapper.kt +++ b/jicoco-config/src/main/kotlin/org/jitsi/config/ConfigSourceWrapper.kt @@ -31,6 +31,5 @@ class ConfigSourceWrapper( override val name: String get() = innerSource.name - override fun getterFor(type: KType): (String) -> Any = - innerSource.getterFor(type) + override fun getterFor(type: KType): (String) -> Any = innerSource.getterFor(type) } diff --git a/jicoco-config/src/main/kotlin/org/jitsi/config/JitsiConfig.kt b/jicoco-config/src/main/kotlin/org/jitsi/config/JitsiConfig.kt index 430dbbfc..1d1dc419 100644 --- a/jicoco-config/src/main/kotlin/org/jitsi/config/JitsiConfig.kt +++ b/jicoco-config/src/main/kotlin/org/jitsi/config/JitsiConfig.kt @@ -35,7 +35,7 @@ class JitsiConfig { /** * A [ConfigSource] loaded via [ConfigFactory]. */ - var TypesafeConfig: ConfigSource = TypesafeConfigSource("typesafe config", loadNewConfig()) + var typesafeConfig: ConfigSource = TypesafeConfigSource("typesafe config", loadNewConfig()) private set private var numTypesafeReloads = 0 @@ -43,8 +43,8 @@ class JitsiConfig { /** * The 'new' [ConfigSource] that should be used by configuration properties. Able to be changed for testing. */ - private val _newConfig: ConfigSourceWrapper = ConfigSourceWrapper(TypesafeConfig).also { - logger.info("Initialized newConfig: ${TypesafeConfig.description}") + private val _newConfig: ConfigSourceWrapper = ConfigSourceWrapper(typesafeConfig).also { + logger.info("Initialized newConfig: ${typesafeConfig.description}") } val newConfig: ConfigSource get() = _newConfig @@ -94,11 +94,11 @@ class JitsiConfig { logger.info("Reloading the Typesafe config source (previously reloaded $numTypesafeReloads times).") ConfigFactory.invalidateCaches() numTypesafeReloads++ - TypesafeConfig = TypesafeConfigSource( + typesafeConfig = TypesafeConfigSource( "typesafe config (reloaded $numTypesafeReloads times)", loadNewConfig() ) - _newConfig.innerSource = TypesafeConfig + _newConfig.innerSource = typesafeConfig } } } diff --git a/pom.xml b/pom.xml index 3f0224d5..ee16400e 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ com.github.gantsign.maven ktlint-maven-plugin - 2.0.0 + 3.0.0 ${project.basedir}/src/main/kotlin