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

Different filter behaviour between Kover & JaCoCo coverage tools #543

Closed
realdadfish opened this issue Feb 16, 2024 · 1 comment · Fixed by #546
Closed

Different filter behaviour between Kover & JaCoCo coverage tools #543

realdadfish opened this issue Feb 16, 2024 · 1 comment · Fixed by #546
Assignees
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch

Comments

@realdadfish
Copy link

realdadfish commented Feb 16, 2024

So my project contains sources that have a package named android in it's package path, like this:

package my.company.project.android.some.package

Sources and tests on these sources are analyzed and covered perfectly with the Kover tool, however, when using JaCoCo, these sources and tests are completely ignored.

This boiles down to my class filter exclusion list, which I configure like this:

 koverReport {
    ...
    filters {
        excludes {
            annotatedBy("*Generated*")
            classes(configuration.classFilter.get())
        }
    }
    ...
}

configuration.classFilter is a ListPropert<String> that contains the entry android.*. Apparently this is interpreted differently between JaCoCo and Kover, because when I removed that entry, even with JaCoCo the coverage was reported just fine.

Environment

  • Kover Gradle Plugin version: 0.7.6-SNAPSHOT
  • Gradle version: 8.5
  • Kotlin project type: Kotlin/Android
  • Coverage Toolset: Kover, JaCoCo
@realdadfish realdadfish added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Feb 16, 2024
shanshin added a commit that referenced this issue Feb 16, 2024
Class filtering in JaCoCo took place by file name. Because previously the absolute path to the class file was taken, the filter worked on any occurrence of the specified string, even if it was no match starting from the root package.

Now the search takes place relative to the classes root directory, which allows you to change the regular expression of the search, and remove arbitrary characters at the beginning in it.

Fixes #543
@shanshin shanshin added S: in progress Status: implementing or design in process and removed S: untriaged Status: issue reported but unprocessed labels Feb 16, 2024
shanshin added a commit that referenced this issue Feb 16, 2024
Class filtering in JaCoCo took place by file name. Because previously the absolute path to the class file was taken, the filter worked on any occurrence of the specified string, even if it was no match starting from the root package.

Now the search takes place relative to the classes root directory, which allows you to change the regular expression of the search, and remove arbitrary characters at the beginning in it.

Fixes #543
PR #546
@shanshin shanshin reopened this Feb 16, 2024
@shanshin shanshin added S: ready for release Status: merged in the main branch and removed S: in progress Status: implementing or design in process labels Feb 16, 2024
@shanshin
Copy link
Collaborator

Fixed in 0.7.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants