api / org.gradle.testing.jacoco.tasks.rules / JacocoViolationRule

JacocoViolationRule

@Incubating interface JacocoViolationRule : Serializable

Defines a Jacoco violation rule.

Since
3.4

Functions

getElement

abstract fun getElement(): String

Gets the element for the rule as defined by org.jacoco.core.analysis.ICoverageNode.ElementType. Valid scope values are BUNDLE, PACKAGE, CLASS, SOURCEFILE and METHOD. Defaults to BUNDLE.

getExcludes

abstract fun getExcludes(): MutableList<String>

List of elements that should be excluded from check. Names can use wildcards (* and ?). If left empty, no elements will be excluded. Defaults to an empty list.

getIncludes

abstract fun getIncludes(): MutableList<String>

List of elements that should be included in check. Names can use wildcards (* and ?). If left empty, all elements will be included. Defaults to [*].

getLimits

abstract fun getLimits(): MutableList<JacocoLimit>

Gets all limits defined for this rule. Defaults to an empty list.

isEnabled

abstract fun isEnabled(): Boolean

Indicates if the rule should be used when checking generated coverage metrics. Defaults to true.

limit

abstract fun limit(configureAction: Action<in JacocoLimit>): JacocoLimit

Adds a limit for this rule. Any number of limits can be added.

setElement

abstract fun setElement(element: String): Unit

Sets element for the rule.

setEnabled

abstract fun setEnabled(enabled: Boolean): Unit

setExcludes

abstract fun setExcludes(excludes: MutableList<String>): Unit

Sets list of elements that should be excluded from check.

setIncludes

abstract fun setIncludes(includes: MutableList<String>): Unit

Sets list of elements that should be included in check.