SonarQube: Enterprise Edition Version 7.8 (build 26217)
SonarScanner: 3.3.0 and 4.4.0
I am trying to get coverage percent on new code for Github PR builds and have tried several combinations of settings to the java sonar scanner tool via the jenkins plugin.
INFO: SCM provider for this project is: git
INFO: 9 files to be analyzed
INFO: 9/9 files analyzed
And those are the nine non ignored files modified in the PR, two of which are completely new swift file, which is correct.
Looking at the PR, I see those nine files listed in the code header with what seems like accurate coverage information. The two new files are 100% covered based on the green bars on the left side when I open up the code viewer.
But when I look at the summary page its showing ‘—Coverage on 0 New Lines to cover’ and the code file browser shows no coverage data on it. Attached two screenshots with sensitive info cropped
In fact, in your screenshot, it appears that the coverage column is empty for both files. You’ve provided your analysis command, but I don’t see you passing any coverage reports in it. Are they specified in a separate sonar-project.properties file? Because every indication is that analysis simply isn’t finding any coverage reports.
And you provide a screenshot showing a coverage marker. But those lines don’t have the “new code” yellow highlight. At the same time, your homepage screenshot shows “-” for coverage and duplications as well. Coverage aside, “-” for duplications is generally an indication that there’s no code in the PR.
You say you’ve added two new Swift files. This may sound like a dumb question, but do they contain lines of code or just comments and whitespace?
As a side note, I just picked up on the fact that you’re running SonarQube 7.7, which is past EOL. The current LTS is 7.9.4 and the current version is 8.4.2. You should upgrade at your earliest convenience. It’s possible that some off this has been worked out in the meantime, although since I’m not clear on what’s going on, I can’t promise that.
The screenshot of the coverage marker is from one of the two swift files that didn’t exist before this PR so it should be marked as new code. And I think that is the main issue here, nothing is actually being marked as new code in this PR and I am trying to understand why. My first guess was for sure the old version of the sonarqube server but I am just an end user and can’t upgrade the server. So I cam here hoping to find a solution hoping I was just missing something.