-
Notifications
You must be signed in to change notification settings - Fork 52
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
Unable to Exclude io.github.oshai.kotlinlogging Classes from Coverage in Kover 0.9.0 #718
Comments
Hi,
|
|
Is changing <configuration>
<filters>
<excludes>
<classes>
<class>io.github.oshai.kotlinlogging.**</class>
</classes>
</excludes>
</filters>
</configuration> to <configuration>
<filters>
<excludes>
<classes>io.github.oshai.kotlinlogging.*</classes>
</excludes>
</filters>
</configuration> helps? |
Ty for your response! But unfortunately it doesn't help. I want to mention that private val logger = KotlinLogging.logger {} is coming from io.github.oshai.kotlinlogging which is an external library. No idea if it matters or not. But whatever I do I can't get 100% coverage because the line val logger = KotlinLogging.logger {} is being market with yellow meaning it's not covered. I am opened to any suggestions. |
Could you provide a small reproducer project? |
Sure, thank you so much for your help. |
The exclusion works on the classes in which the code is called, but not for the classes used (because it is important in which class the executable code was written, and this line is written in the In any case, even if you exclude line |
it is easier to exclude the entire class TestLogger I understand but because we are talking about a logger, which is present in my whole application, it means I will have to exclude so many classes that it doesn't make sense to generate the report anymore. What should I do in order to achieve 100% coverage? |
You can exclude lambda for all <configuration>
<filters>
<excludes>
<classes>*$logger$1</classes>
</excludes>
</filters>
</configuration> |
Thank you for all your help! It was exactly what I looking for! Many thanks <3 ! |
We can close this! |
Body:
Hello Kover team,
I’m currently using the kover-maven-plugin (version 0.9.0) and having trouble excluding certain classes/packages from my coverage reports. Specifically, I would like to exclude all classes under the io.github.oshai.kotlinlogging package, as I don’t want my logging code to affect coverage metrics.
private val logger = KotlinLogging.logger {}
What I’ve Tried:
1. Configuring in the plugin configuration to include io.github.oshai.kotlinlogging.**.
2. Trying various patterns and even specifying classes like io.github.oshai.kotlinlogging.KotlinLogging.
3. Running mvn clean verify after each change to ensure changes are picked up.
Despite these attempts, the coverage reports still show the logging classes as partially covered. I’ve reviewed the documentation and previous issues but haven’t found a working solution.
Environment:
• Maven version: 3.9.9
• JDK version: 17
• Kotlin version: 1.9.25
• Kover plugin version: 0.9.0
Questions:
1. Is there a known issue with excluding certain classes or packages in version 0.9.0?
2. Are there recommended patterns or configurations that reliably exclude packages like io.github.oshai.kotlinlogging?
Any guidance or examples would be greatly appreciated. Thank you for your time and help!
The text was updated successfully, but these errors were encountered: