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

## Interface JacocoViolationRule

- All Superinterfaces:
    `java.io.Serializable`

      public interface JacocoViolationRule
      extends java.io.Serializable

  Defines a Jacoco violation rule.
  Since:
    3.4

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getElement()` | Gets the element for the rule as defined by org.jacoco.core.analysis.ICoverageNode.ElementType.
    `java.util.List<java.lang.String>` | `getExcludes()` | List of elements that should be excluded from check.
    `java.util.List<java.lang.String>` | `getIncludes()` | List of elements that should be included in check.
    `java.util.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​(java.lang.String element)` | Sets element for the rule.
    `void` | `setEnabled​(boolean enabled)` |
    `void` | `setExcludes​(java.util.List<java.lang.String> excludes)` | Sets list of elements that should be excluded from check.
    `void` | `setIncludes​(java.util.List<java.lang.String> includes)` | Sets list of elements that should be included in check.

- - ### Method Detail

    - #### 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​(java.lang.String element)

      Sets element for the rule.
      Parameters:
        `element` - Element

    - #### getElement

          @Input
          java.lang.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​(java.util.List<java.lang.String> includes)

      Sets list of elements that should be included in check.
      Parameters:
        `includes` - Inclusions

    - #### getIncludes

          @Input
          java.util.List<java.lang.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​(java.util.List<java.lang.String> excludes)

      Sets list of elements that should be excluded from check.
      Parameters:
        `excludes` - Exclusions

    - #### getExcludes

          @Input
          java.util.List<java.lang.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
          java.util.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.