Weird value of new code coverage 0% on 2 lines to cover

We have a weird situation with one of our repositories. After one of our merge to master SQ analysis has started to show 0% of new code coverege. And only 2 new lines to cover. Although this last push had much more code than those 2 lines of code. Overall code coverage is 80% for this project. Our New Code period is 365 days and our first SQ analysis was 23rd of October 2020.

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Community Version 8.2 (build 32929)
  • what are you trying to achieve
    Proper measurement of new code coverage.
  • what have you tried so far to achieve this
    I have made master analysis on few different configurations of New Code Period:
    Last 365 days
    Specific version 23th of October
    Specific version 6th of November (which was the next analysis)
    In all configurations the results were exactly the same.

Additionally I created a new branch based on version from 23th of October and run the analysis, next I push force master branch to this newly created branch and run the analysis again.
The 2nd analysis was set up to be compared with the 1st analysis on that branch (specific version of new code period).
The result was completly different. It shows 95% new code coverage on 45 new lines to cover which seams to be a valid result.

Hi,

Welcome to the community!

Are both of the lines covered?

Does it have many more lines or many more coverable lines of code?

This raises 2 questions for me:

  • Is coverage data correctly / fully passed in to your main branch analysis?
  • Are you sure your main branch New Code Period is what you think it is?

 
Ann

Hi,
Thank you for your response.
Both lines are not covered.
New Code Period is set up correctly, I double checked it.

FIrst I thought it had a lot of new code of coverable lines of code because that what the difftool and review tool has shown me. But when I looked at SQ code again today in details it shows me that some lines of code was changed before 23 of October which I expected that those lines of code are a new code as review tool shown me.

So to sum up I rechecked all the commited code and it turns out that SQ assumes new code only the code which was commited after the 23th of October (new code period) even when that “old” commit was pushed to master branch two weeks ago.
All the code newer than 23th of October was in fact those 2 uncovered lines.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.