All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.gitlab.arturbosch.detekt.sample.extensions.SampleConfigValidator.kt Maven / Gradle / Ivy

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy