Package org.gradle.testing.jacoco.tasks.rules

# Interface JacocoViolationRule

All Superinterfaces:
  `Serializable`

@Incubating public interface JacocoViolationRule extends Serializable
Defines a Jacoco violation rule.

Since:
  3.4

## Method Summary

Modifier and Type
Method
Description
`String`
`getElement()`
Gets the element for the rule as defined by org.jacoco.core.analysis.ICoverageNode.ElementType.
`List<String>`
`getExcludes()`
List of elements that should be excluded from check.
`List<String>`
`getIncludes()`
List of elements that should be included in check.
`List<JacocoLimit>`
`getLimits()`
Gets all limits defined for this rule.
`boolean`
`isEnabled()`
Indicates if the rule should be used when checking generated coverage metrics.
`JacocoLimit`
`limit(Action<? super JacocoLimit> configureAction)`
Adds a limit for this rule.
`void`
`setElement(String element)`
Sets element for the rule.
`void`
`setEnabled(boolean enabled)`
`void`
`setExcludes(List<String> excludes)`
Sets list of elements that should be excluded from check.
`void`
`setIncludes(List<String> includes)`
Sets list of elements that should be included in check.

## Method Details

### setEnabled

void setEnabled(boolean enabled)

### isEnabled

@Input boolean isEnabled()
Indicates if the rule should be used when checking generated coverage metrics. Defaults to true.

### setElement

void setElement(String element)
Sets element for the rule.

Parameters:
  `element` - Element

### getElement

@Input String getElement()
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.

### setIncludes

void setIncludes(List<String> includes)
Sets list of elements that should be included in check.

Parameters:
  `includes` - Inclusions

### getIncludes

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

### setExcludes

void setExcludes(List<String> excludes)
Sets list of elements that should be excluded from check.

Parameters:
  `excludes` - Exclusions

### getExcludes

@Input List<String> getExcludes()
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.

### getLimits

@Input List<JacocoLimit> getLimits()
Gets all limits defined for this rule. Defaults to an empty list.

### limit

JacocoLimit limit(Action<? super JacocoLimit> configureAction)
Adds a limit for this rule. Any number of limits can be added.