Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluded from report companion objects with only constants #603

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]

intellij-coverage = "1.0.748"
intellij-coverage = "1.0.752"
junit = "5.9.0"
kotlinx-bcv = "0.13.2"
kotlinx-dokka = "1.8.10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ internal fun ClassFilters.convert(): Filters {
return Filters(
convert(includeClasses),
convert(excludeClasses),
convert(excludeAnnotation)
emptyList(),
convert(excludeAnnotation),
emptyList(),
emptyList()
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2017-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.kover.gradle.plugin.test.functional.cases

import kotlinx.kover.gradle.plugin.test.functional.framework.checker.CheckerContext
import kotlinx.kover.gradle.plugin.test.functional.framework.starter.TemplateTest

internal class ConstantObjectTests {

/**
* All objects that contain only constants should be excluded from the report.
*/
@TemplateTest("counters", ["koverXmlReport"])
fun CheckerContext.testBasicCounterCases() {
xmlReport {
classCounter("org.jetbrains.ConstantHolder").assertAbsent()
classCounter("org.jetbrains.InterfaceWithCompanion${"$"}Companion").assertAbsent()
classCounter("org.jetbrains.InterfaceWithNamedCompanion${"$"}Named").assertAbsent()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,22 @@ object UsedObjectFun {
println("Hello")
}
}

object ConstantHolder {
const val STRING_CONST = "STRING_CONST"
const val INT_CONST = 42
}

interface InterfaceWithCompanion {
companion object {
const val STRING_CONST = "STRING_CONST"
const val INT_CONST = 42
}
}

interface InterfaceWithNamedCompanion {
companion object Named {
const val STRING_CONST = "STRING_CONST"
const val INT_CONST = 42
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public object KoverVersions {
/**
* Kover coverage tool version.
*/
public const val KOVER_TOOL_VERSION = "1.0.748"
public const val KOVER_TOOL_VERSION = "1.0.752"

/**
* JaCoCo coverage tool version used by default.
Expand Down