Config Aware
Interface which is implemented by each Rule class to provide utility functions to retrieve specific or generic properties from the underlying detekt configuration file.
Be aware that there are three config levels by default:
the top level config layer specifies rule sets and detekt engine properties
the rule set level specifies properties concerning the whole rule set and rules
the rule level provides additional properties which are used to configure rules
This interface operates on the rule set level as the rule set config is passed to each rule in the #RuleSetProvider interface. This is due the fact that users create the rule set and all rules upfront and letting them 'sub config' the rule set config would be error-prone.
Functions
Retrieves a sub configuration or value based on given key. If the configuration property cannot be found, null is returned.
If your rule supports to automatically correct the misbehaviour of underlying smell, specify your code inside this method call, to allow the user of your rule to trigger auto correction only when needed.
Properties
Wrapped configuration of the ruleSet this rule is in. Use valueOrDefault function to retrieve properties specified for the rule implementing this interface instead. Only use this property directly if you need a specific rule set property.