WatchdogGradleExtension

The apiWatchdog block: the enabled switch and the severity of each configurable diagnostic. Default severity is WatchdogSeverity.ERROR unless the property states another.

See Configuration for more details.

apiWatchdog {
undocumentedPublicApi = WatchdogSeverity.WARNING
dataClassPublicApi = WatchdogSeverity.NONE
}

Properties

Link copied to clipboard

Severity of BOOLEAN_PARAMETER_PUBLIC_API: Boolean parameters of public functions.

Link copied to clipboard

Severity of DATA_CLASS_PUBLIC_API: data classes in the public API.

Link copied to clipboard

Severity of DSL_MARKER_NOOP_TARGET: DSL marker targets without scope-control effect.

Link copied to clipboard

Severity of DSL_MARKER_NOOP_TYPE_POSITION: DSL markers on type positions without effect.

Link copied to clipboard

Severity of DSL_MARKER_WITHOUT_EXPLICIT_TARGETS: DSL markers with the default target set.

Link copied to clipboard
val enabled: Property<Boolean>

Whether the watchdog runs. Default is true.

Link copied to clipboard

Severity of EXHAUSTIVE_PUBLIC_API: exhaustively matchable enums and sealed hierarchies.

Link copied to clipboard

Severity of FUNCTION_TYPE_ALIAS_PUBLIC_API: type aliases that abbreviate function types.

Link copied to clipboard

Severity of INCONSISTENT_PARAMETER_ORDER_IN_OVERLOADS: overloads with different positions for shared parameters.

Link copied to clipboard

Severity of INLINE_FUNCTION_WITH_LOGIC: inline functions and accessors that do more than delegate.

Link copied to clipboard
val internalApiAnnotations: SetProperty<String>

Fully qualified names of annotation classes that mark internal API, besides those that carry @InternalAnnotationMarker. The watchdog skips the declarations under such an annotation, and PUBLIC_TYPE_WITH_INTERNAL_API reports a public declaration that exposes a type marked with it. Use it for the internal-API annotation of a dependency:

Link copied to clipboard
Link copied to clipboard

Severity of MUTABLE_COLLECTION_PUBLIC_API: mutable collections and arrays in public signatures.

Link copied to clipboard

Severity of NULLABLE_BOOLEAN_PUBLIC_API: nullable Booleans in public signatures.

Link copied to clipboard

Severity of OPEN_API_WITHOUT_SUBCLASS_OPT_IN: unrestricted external subclassing.

Link copied to clipboard

Severity of PAIR_OR_TRIPLE_PUBLIC_API: Pair and Triple in public signatures.

Link copied to clipboard

Whether PUBLIC_TYPE_FROM_NON_TRANSITIVE_DEPENDENCY runs. Default is true. A violation is always an error. To accept the types of selected dependencies, declare them on the apiWatchdogExemptNonTransitive configuration instead.

Link copied to clipboard

Whether PUBLIC_TYPE_WITH_INTERNAL_API runs. Default is true. A violation is always an error. @IntentionallyExposedInternalApiForBackwardsCompatibility exempts a published declaration.

Link copied to clipboard

The formats of the report that generateApiWatchdogReport and exemptExistingApi write, see WatchdogReports. Both formats are on by default.

Link copied to clipboard

Whether UNDOCUMENTED_PUBLIC_API reports the member properties of a class. Default is false, because the check doesn't read the @property tags of the class KDoc.

Link copied to clipboard

Severity of REQUIRED_PARAMETER_AFTER_OPTIONAL: required parameters declared after optional ones.

Link copied to clipboard

Severity of STATEFUL_CLASS_WITHOUT_EQUALS: stateful classes without an equals implementation.

Link copied to clipboard

Severity of STATEFUL_CLASS_WITHOUT_HASH_CODE: stateful classes without a hashCode implementation.

Link copied to clipboard

Severity of STATEFUL_CLASS_WITHOUT_TO_STRING: stateful classes without a toString implementation.

Link copied to clipboard

Severity of SUBCLASS_OPT_IN_WITHOUT_MARKERS: @SubclassOptInRequired without markers.

Link copied to clipboard

Whether the build warns when neither the Kotlin Gradle plugin's ABI validation nor the Binary Compatibility Validator plugin is active. Default is true.

Link copied to clipboard

Severity of UNDOCUMENTED_PUBLIC_API: public declarations without KDoc. Default is WatchdogSeverity.WARNING.

Functions

Link copied to clipboard
fun ignore(checks: List<WatchdogChecks>, whenAnnotatedWith: String, recursive: Boolean = false)

Ignores every check in checks on a declaration that carries the whenAnnotatedWith annotation. The same as a call of the single-check overload for each check:

fun ignore(checks: List<WatchdogChecks>, whenAnnotatedWith: List<String>, recursive: Boolean = false)

Ignores every check in checks on a declaration that carries one of the whenAnnotatedWith annotations. The same as a call of the single-check overload for each check:

fun ignore(check: WatchdogChecks, whenAnnotatedWith: String, recursive: Boolean = false)

Ignores check on a declaration that carries the whenAnnotatedWith annotation. The same as the overload that takes a list of annotations:

fun ignore(check: WatchdogChecks, whenAnnotatedWith: List<String>, recursive: Boolean = false)

Ignores check on a declaration that carries one of the whenAnnotatedWith annotations. An annotation is its fully qualified class name:

Link copied to clipboard

Configures javaInterop.

Link copied to clipboard
fun reports(action: Action<WatchdogReports>)

Configures reports.