Base Rule
Defines the visiting mechanism for KtFile's.
Custom rule implementations should actually use Rule as base class.
This base rule class abstracts over single and multi rules and allows the detekt core engine to only care about a single type.
Inheritors
Functions
Clears previous findings. Normally this is done on every new KtFile analyzed and should be called by clients.
Reports a single new violation. By contract the implementation can check if this finding is already suppressed and should not get reported. An alias set can be given to additionally check if an alias was used when suppressing. Additionally suppression by rule set id is supported.
Same as report but reports a list of findings.
Basic mechanism to decide if a rule should run or not.
Before starting visiting kotlin elements, a check is performed if this rule should be triggered. Pre- and post-visit-hooks are executed before/after the visiting process. BindingContext holds the result of the semantic analysis of the source code by the Kotlin compiler. Rules that rely on symbols and types being resolved can use the BindingContext for this analysis. Note that detekt must receive the correct compile classpath for the code being analyzed otherwise the default value BindingContext.EMPTY will be used and it will not be possible for detekt to resolve types or symbols.