Excluding methods by name

14 views
Skip to first unread message

Benjamin van der Veen

unread,
Feb 18, 2025, 10:23:17 PMFeb 18
to JaCoCo and EclEmma Users
Hi folks,

First of all, I'm not sure I'm barking up the right tree—I'm coming here by way of the gradle plugin. Correct me if I'm in the wrong place. Second, yes, I have searched the github issues, pull requests, and this mailing list.

I got a coverage report generating in CI and I was pleased to find that the project I'm working on is right around 67% coverage. Not bad! Investigating further, I noticed that a large amount of what is not covered is `toString` `equals` and `hashCode`. These are all generated by the IDE. I want these to not figure in the reports.

I've seen suggestion that I could declare my own annotation with the word `Generated` in it and apply, one by one, to the methods in question. Suffice to say I don't want to do that.

I haven't found any way to simply filter methods by name from the coverage report. And I haven't found anyone directly asking for this, either. Am I missing something? Or am I the  crazy one for wanting to blanket exclude these three methods in particular?

I'm appreciative of any advice. I might even be up for making a pull request for a feature like this—simply filtering method out of the coverage report by name/regex.

Kind regards,
Benjamin van der Veen



Marc Hoffmann

unread,
Feb 19, 2025, 11:00:53 AMFeb 19
to jac...@googlegroups.com
Hi Benjamin,

JaCoCo (which does the work behind the scenes) does not support configurable method exclusions. Unfortunately this is nowadays not as easy as it sounds, as boundaries between methods get blurry with modern language features like lambdas.

Cheers,
-marc


--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jacoco/c29429ad-060b-4331-8283-6323c4b268a7n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages