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
abstract 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(context: SetupContext)

Setup extension by querying common paths and config options.

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

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)

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, issues: List<Issue>)

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>)

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.