gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
171 stars 42 forks source link

`Merge-JaCoCoReport`: Calculates hit count correctly? #392

Open johlju opened 2 years ago

johlju commented 2 years ago

Problem description

Currently the hit count is overwritten when the merge document's <line> has a hit count higher than the original document's <line>:

https://github.com/gaelcolas/Sampler/blob/02cc8da49a8d837f48c167db56c1ace18fdb5bef/Sampler/Public/Merge-JaCoCoReport.ps1#L89-L96

But shouldn't the hit count of the merge document be added to the count of the original document?

Example:

  Original ci = 1
     Merge ci = 2

        Result: 3

And shouldn't it always add to the hit count, not just when original line is less than the merge line?

Example:

  Original ci = 1
     Merge ci = 1

        Result: 2

This is also true for missed hit count that can be more than 1.

Example from the project SqlServerDsc and the DSC resource SqlAg (DSC_SqlAg.psm1):

<line nr="300" mi="3" ci="0" mb="0" cb="0" />
<line nr="301" mi="1" ci="0" mb="0" cb="0" />
<line nr="303" mi="2" ci="0" mb="0" cb="0" />

Verbose logs

n/a

How to reproduce

I possible to create a unit tests that shows that hit count is overwritten.

Expected behavior

Uncertain how hit count should be calculated so I opened this issue for future improvement.

Current behavior

Current behavior could be correct, but feels wrong.

Suggested solution

Uncertain how hit count should be calculated so I opened this issue for future improvement.

Operating system the target node is running

n/a

PowerShell version and build the target node is running

n/a

Module version used

0.115.0