Context

interface Context

A context describes the storing and reporting mechanism of Finding's inside a Rule. Additionally it handles suppression and aliases management.

The detekt engine retrieves the findings after each KtFile visit and resets the context before the next KtFile.

Functions

Link copied to clipboard
abstract fun clearFindings()

Clears previous findings. Normally this is done on every new KtFile analyzed and should be called by clients.

Link copied to clipboard
open fun report(finding: Finding, aliases: Set<String> = emptySet(), ruleSetId: RuleSetId? = null)

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.

open fun report(findings: List<Finding>, aliases: Set<String> = emptySet(), ruleSetId: RuleSetId? = null)

Same as report but reports a list of findings.

Properties

Link copied to clipboard
abstract val findings: List<Finding>

Inheritors

Link copied to clipboard
Link copied to clipboard