kotlinx-kover
kotlinx-kover copied to clipboard
Feature: Option for Automatic Exclusion for Data Classes, Interfaces and other constructs
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.
We need to analyze the possibility of this when switching to Kotlin Gradle Plugin