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

net.twisterrob.gradle.quality.gather.QualityTaskReportGatherer.kt Maven / Gradle / Ivy

The newest version!
package net.twisterrob.gradle.quality.gather

import net.twisterrob.gradle.common.TargetChecker
import org.gradle.api.Task
import org.gradle.api.reporting.ReportContainer
import org.gradle.api.reporting.Reporting
import org.gradle.api.reporting.SingleFileReport
import se.bjurr.violations.lib.model.Violation
import se.bjurr.violations.lib.reports.Parser
import java.io.File

class QualityTaskReportGatherer(
	private val displayName: String,
	taskType: Class,
	private var parser: Parser
) : TaskReportGatherer(taskType) where
T : Task,
T : TargetChecker,
T : Reporting> {

	override fun getParsableReportLocation(task: T): File =
		@Suppress("detekt.MaxChainedCallsOnSameLine") // Simple enough.
		task.reports.getByName("xml").outputLocation.get().asFile

	override fun getHumanReportLocation(task: T): File =
		@Suppress("detekt.MaxChainedCallsOnSameLine") // Simple enough.
		task.reports.getByName("html").outputLocation.get().asFile

	override fun getName(task: T): String =
		task.checkTargetName

	override fun getDisplayName(task: T): String =
		displayName

	override fun findViolations(report: File): List =
		parser.findViolations(NoOpLogger, listOf(report)).toList()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy