FileProcessListener

Gather additional metrics about the analyzed kotlin file. Pay attention to the thread policy of each function!

A bindingContext != BindingContext.EMPTY is only available if Kotlin compiler settings are used.

Properties

Link copied to clipboard
open val id: String

Name of the extension.

Link copied to clipboard
open val priority: Int

Is used to run extensions in a specific order. The higher the priority the sooner the extension will run in detekt's lifecycle.

Functions

Link copied to clipboard
open fun init(config: Config)

Allows to read any or even user defined properties from the detekt yaml config to setup this extension.

open fun init(context: SetupContext)

Setup extension by querying common paths and config options.

Link copied to clipboard
open fun onFinish(files: List<KtFile>, result: Detektion, bindingContext: BindingContext)

Mainly use this method to save computed metrics from KtFile's to the {@link Detektion} container. Do not do heavy computations here as this method is called from the main thread.

Link copied to clipboard
open fun onProcess(file: KtFile, bindingContext: BindingContext)

Called when processing of a file begins. This method is called from a thread pool thread. Heavy computations allowed.

Link copied to clipboard
open fun onProcessComplete(file: KtFile, findings: Map<String, List<Finding>>, bindingContext: BindingContext)

Called when processing of a file completes. This method is called from a thread pool thread. Heavy computations allowed.

Link copied to clipboard
open fun onStart(files: List<KtFile>, bindingContext: BindingContext)

Use this to gather some additional information for the real onProcess function. This calculation should be lightweight as this method is called from the main thread.