io.gitlab.arturbosch.detekt.cli.config.DefaultPropertiesConfigValidator.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detekt-cli Show documentation
Show all versions of detekt-cli Show documentation
Static code analysis for Kotlin
package io.gitlab.arturbosch.detekt.cli.config
import io.gitlab.arturbosch.detekt.api.Config
import io.gitlab.arturbosch.detekt.api.ConfigValidator
import io.gitlab.arturbosch.detekt.api.Notification
import io.gitlab.arturbosch.detekt.api.internal.CommaSeparatedPattern
import io.gitlab.arturbosch.detekt.api.internal.DEFAULT_PROPERTY_EXCLUDES
import io.gitlab.arturbosch.detekt.api.internal.DefaultRuleSetProvider
import io.gitlab.arturbosch.detekt.api.internal.validateConfig
import io.gitlab.arturbosch.detekt.cli.loadDefaultConfig
import io.gitlab.arturbosch.detekt.core.ProcessingSettings
import io.gitlab.arturbosch.detekt.core.RuleSetLocator
class DefaultPropertiesConfigValidator(
private val settings: ProcessingSettings
) : ConfigValidator {
override fun validate(config: Config): Collection {
fun patterns(): Set {
val pluginExcludes = RuleSetLocator(settings).load()
.filter { it !is DefaultRuleSetProvider }
.joinToString(",") { "${it.ruleSetId}.*" }
val configExcludes = config.subConfig("config").valueOrDefault("excludes", "")
val allExcludes = "$configExcludes,$DEFAULT_PROPERTY_EXCLUDES,$pluginExcludes"
return CommaSeparatedPattern(allExcludes).mapToRegex()
}
return validateConfig(config, loadDefaultConfig(), patterns())
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy