https://kotlinlang.org logo
Title
l

Lukasz Kalnik

01/26/2023, 3:55 PM
Can kover be configured to exclude all generated classes under
build
directories?
p

Pedro Alberto

01/26/2023, 3:59 PM
I don't think is taking that into account
l

Lukasz Kalnik

01/26/2023, 4:01 PM
Then how can I exclude e.g. the
*FragmentDirections
and
*FragmentArgs
classes?
This doesn't help:
filters {
        classes {
            excludes.addAll(
                listOf(
                    "*Fragment",
                    "*Fragment\$*",
                    "*FragmentDirections",
                    "*FragmentArgs",
                    "*Activity",
                    "*Activity\$*",
                    "*BuildConfig",
                )
            )
        }
j

Javier

01/26/2023, 4:01 PM
are they not internal?
l

Lukasz Kalnik

01/26/2023, 4:02 PM
What do you mean by "internal"?
j

Javier

01/26/2023, 4:02 PM
I think that should work
l

Lukasz Kalnik

01/26/2023, 4:02 PM
This is the report I get
j

Javier

01/26/2023, 4:03 PM
check the rules maybe I am missing something
l

Lukasz Kalnik

01/26/2023, 4:03 PM
No, they are public
image.png
The weird thing is, my rules above seem to work for
Fragment
but not for
FragmentArgs
or
Directions
So I asked in kover GitHub repository and it turns out, to exclude classes like
...FragmentArgs
or
...FragmentDirections
you have to use the following exclusion rule:
*Fragment*
Here the original answer: https://github.com/Kotlin/kotlinx-kover/issues/297#issuecomment-1406181952