detekt-api
1.21.0-RC2

# FileProcessListener

interface FileProcessListener : Extension
Content copied to clipboard

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.

## Functions

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

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

open fun init (context: SetupContext )
Content copied to clipboard

Setup extension by querying common paths and config options.

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

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.

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

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

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

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

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

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.

## Properties

id
Link copied to clipboard
open val id : String
Content copied to clipboard

Name of the extension.

priority
Link copied to clipboard
open val priority : Int
Content copied to clipboard

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