Skip to content

Feature: Option for Automatic Exclusion for Data Classes, Interfaces and other constructs #780

@alexandersumer

Description

@alexandersumer

Proposed API

Excluding untestable types from coverage should be an automatic configuration option, not a manual burden on the developer.

kover {
    excludeDataClasses = true
    excludeInterfaces = true
}

The Problem

Coverage reports are currently cluttered with structural types that have little to no testable logic:

  • Data classes are mostly compiler-generated bytecode (equals, hashCode, toString, copy)
  • Interfaces are pure contracts without implementation

Why Annotations Aren't the Solution

Using @ExcludeFromCoverage has several drawbacks:

  • Wrong place: Coverage settings belong in the build configuration, not the source code
  • Unscalable: Manually annotating hundreds of DTOs is tedious, error-prone toil
  • Silent decay: New classes degrade coverage metrics by default until a developer remembers to tag them

Feasibility

Since Kover is Kotlin-native, it can detect these types via @kotlin.Metadata or bytecode signatures reliably.

Metadata

Metadata

Assignees

Labels

FeatureFeature request issue typeImplement in KGPS: postponedStatus: work on the issue is not in the short term plans

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions