kotlinx-kover
kotlinx-kover copied to clipboard
Add a way to exclude generated classes implementing an annotated interface
What is your use-case and why do you need this feature? On Android, Room uses DAO interfaces to generate SQL related code at compile time. Example:
ProjectDao.kt (source code)
package fr.delcey.todok.data.dao
// imports...
@Dao
interface ProjectDao {
// code
}
ProjectDao_Impl.java (generated)
package fr.delcey.todok.data.dao;
// imports...
@SuppressWarnings({"unchecked", "deprecation"})
public final class ProjectDao_Impl implements ProjectDao {
// generated code...
}
Describe the solution you'd like
I don't really know, maybe add a way to exclude classes that implement an annotated interface (@Dao in this case) ?
Another solution would be to be able to ignore every class in the generated folder but I guess Kover doesn't have this kind of information available. Another solution would be to update Room in order to annotate their generated classes with @Generated, but I don't know if it's common for this kind of lib.
Hi,
is it acceptable for you to add an exclusion filter like *Dao_Impl?
An exception by inheritance can be added, but this will require a more flexible way of writing filters, which may be added sometime in the future.
Yes I was mainly basing my excludes with suffixes but it's not 100% resilient (typo, rename, new architecture convention, etc).
This is not a huge issue ATM, and if the DSL to configure is too hard to maintain / configure, this may be a bad idea.
But would a more flexible way to add filters be considered, I hope "filtering by heritance of annotated interface" will make it.
Relates #454