io.gitlab.arturbosch.detekt.test.RuleSetExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of detekt-test Show documentation
Show all versions of detekt-test Show documentation
Static code analysis for Kotlin
package io.gitlab.arturbosch.detekt.test
import io.gitlab.arturbosch.detekt.api.Config
import io.gitlab.arturbosch.detekt.api.RuleSet
import io.gitlab.arturbosch.detekt.api.RuleSetProvider
/**
* Loads a [RuleSet] instance of given RuleSetProvider.
*/
inline fun loadRuleSet(config: Config = Config.empty): RuleSet {
val provider = T::class.java.constructors[0].newInstance() as? T
?: error("Could not load RuleSet for '${T::class.java}'")
return provider.instance(config.subConfig(provider.ruleSetId))
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy