Sonarqube Pull Requests calculating new code stats when merged into target branch

Hi All:

I started looking at Pull requests a little bit more closely. I extracted all of the new_* metrics from each PR id and added them up. When I compare to the new_* metric in the target branch that was merged into the totals are no where near. How should I interpret what the metrics are on the pull request compared to will all the PRs are merged. I was expecting everything to add up in terms of new code.


Hi Peter,

Welcome to the community!

It’s not clear to me what you added up. I guess you summed the PR issue counts and expected them to equal the number of new issues in the branch?

Unfortunately, it’s possible for additional new issues to show up after PR merge. Why? Because PR analysis reports on the lines changed in the branch. But if, for instance, my PR removes the only use of a private class member, no issue is raised in the PR because the declaration wasn’t changed in the PR. That issue only shows up after merge.

Does that help?