All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.gitlab.arturbosch.detekt.extensions.DetektReports.kt Maven / Gradle / Ivy

There is a newer version: 1.23.7
Show newest version
package io.gitlab.arturbosch.detekt.extensions

import groovy.lang.Closure
import io.gitlab.arturbosch.detekt.extensions.DetektReportType.HTML
import io.gitlab.arturbosch.detekt.extensions.DetektReportType.TXT
import io.gitlab.arturbosch.detekt.extensions.DetektReportType.XML
import io.gitlab.arturbosch.detekt.extensions.DetektReportType.SARIF
import org.gradle.util.ConfigureUtil

@Suppress("TooManyFunctions")
class DetektReports {

    val xml = DetektReport(XML)

    val html = DetektReport(HTML)

    val txt = DetektReport(TXT)

    val sarif = DetektReport(SARIF)

    val custom = mutableListOf()

    fun xml(configure: DetektReport.() -> Unit) = xml.configure()
    fun xml(closure: Closure<*>): DetektReport = ConfigureUtil.configure(closure, xml)

    fun html(configure: DetektReport.() -> Unit) = html.configure()
    fun html(closure: Closure<*>): DetektReport = ConfigureUtil.configure(closure, html)

    fun txt(configure: DetektReport.() -> Unit) = txt.configure()
    fun txt(closure: Closure<*>): DetektReport = ConfigureUtil.configure(closure, txt)

    fun sarif(configure: DetektReport.() -> Unit) = sarif.configure()
    fun sarif(closure: Closure<*>): DetektReport = ConfigureUtil.configure(closure, sarif)

    fun custom(configure: CustomDetektReport.() -> Unit) = createAndAddCustomReport().configure()
    fun custom(closure: Closure<*>): CustomDetektReport = ConfigureUtil.configure(closure, createAndAddCustomReport())

    private fun createAndAddCustomReport() = CustomDetektReport().apply { custom.add(this) }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy