Closed KarimFikani closed 3 years ago
I think I have time to fix this in the morning. It should be a quick fix, and I'll release an update.
Any thoughts on what the behavior should be if jacoco finds 0 branches? That implies no if, switch, or loops. I believe that normal branch counting would treat such a case as a single branch, but it looks like jacoco does not. I'm thinking to just use 100% for the no branch case.
That would great! Thank you!
@KarimFikani Thank you for reporting the bug. I just released a fix in v1.2.1. I fixed it in both the no branches and no instructions cases just in case. The no branches case is more likely since it is possible to have no branching statements. I think the only way the no instructions case would come up is if someone ran jacoco at the very start of a project on an empty class, but better to be safe so I went with the same behavior (0 instructions = 100% coverage, 0 branches = 100% branch coverage).
Hey, first of all thank you for this helpful plugin.
When I'm running the plugin "cicirello/jacoco-badge-generator@v1.2.0" in my workflow I'm getting this error:
Traceback (most recent call last): File "/JacocoBadgeGenerator.py", line 189, in
cov, branches = computeCoverage(jacocoCsvFile)
File "/JacocoBadgeGenerator.py", line 96, in computeCoverage
return covered / (covered + missed), coveredBranches / (coveredBranches + missedBranches)
ZeroDivisionError: division by zero
I opened my csv file and yes I can see zeros in the data, specifically I see BRANCH_MISSED and BRANCH_COVERED in some tests are both 0. So is it the problem from jacoc for not filling those columns with data or the script can omit these tests cases if both covered and missed are 0?