I seem to be stuck with adding custom rule set in my KMP project, not sure what I might be missing.
So I’ve got a
build-logic
custom Gradle module with various build conventions. In there I have a gradle plugin extension that applies and configures Detekt Gradle plugin (that works with existing rules). Now, I added my own custom rule set, following official guide, but the rule does not seem to be picked up, what am I missing?
1. create custom Detekt rule, say,
MyRule
2. create custom rule set, say,
MyRuleSetProvider
that includes
MyRule
package com.example
class MyRuleSetProvider : RuleSetProvider {
override val ruleSetId: String = "MyRuleSet"
override fun instance(config: Config): RuleSet {
return RuleSet(
id = ruleSetId,
rules = listOf(
MyRule(config)
)
)
}
}
3. define
build-logic/resources/META-INF/services/io.gitlab.arturbosch.detekt.api.RuleSetProvider
com.example.MyRuleSetProvider
4. define detekt yml config
build-logic/resources/config.yml
MyRuleSet:
MyRule:
active: true