io.gitlab.arturbosch.detekt.sample.extensions.SampleConfigValidator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detekt-sample-extensions Show documentation
Show all versions of detekt-sample-extensions Show documentation
Static code analysis for Kotlin
The newest version!
package io.gitlab.arturbosch.detekt.sample.extensions
import io.gitlab.arturbosch.detekt.api.Config
import io.gitlab.arturbosch.detekt.api.ConfigValidator
import io.gitlab.arturbosch.detekt.api.Notification
class SampleConfigValidator : ConfigValidator {
override fun validate(config: Config): Collection {
val result = mutableListOf()
runCatching {
config.subConfig("sample")
.subConfig("TooManyFunctions")
.valueOrNull("active")
}.onFailure {
result.add(SampleMessage("'active' property must be of type boolean."))
}
return result
}
}
class SampleMessage(
override val message: String,
override val level: Notification.Level = Notification.Level.Error
) : Notification