Sonar GH Scanner

37 views
Skip to first unread message

jakub...@adspired.com

unread,
Mar 22, 2017, 12:17:25 PM3/22/17
to SonarQube
HI! 
I've recently upgraded from Sonar 5.3 to Sonar 6.3. (gradle plugin was upgraded from 1.1 to 2.2.1)
I'm heavily using the sonar scanner for analysing GH Pull Requests and noticed that now it analyses the whole files that were modified and not only the diff.

Is this a regression, something expected or configurable?

Kuba

janos....@sonarsource.com

unread,
Mar 23, 2017, 11:25:37 AM3/23/17
to SonarQube, jakub...@adspired.com
Hi,

This is not expected, and I have no idea how this could happen. We're using this plugin constantly with the latest SonarQube and haven't seen this issue, which would be immediately visible.

Are you sure the pull requests where you noticed did not change all the lines in the files? For example by changing line endings, or reformatting? Are you able to reproduce it by creating a pull request with a simple change?

Cheers,
Janos

jakub...@adspired.com

unread,
Mar 23, 2017, 12:21:25 PM3/23/17
to SonarQube, jakub...@adspired.com
Yes, 
changing a couple of lines on a single files results in raising violations in the whole file.
All of those violations are listed in the summary comment on PR. 
The really modified lines are additionally annotated with inline comments, but AFAIK GH API rejects annotation to lines that were not modified in a PR.
Can I somehow turn on some debug on a sonar analyser to check why this is happening? 
My repose are private so I cannot share an example.

Julien HENRY

unread,
Mar 28, 2017, 4:37:46 AM3/28/17
to SonarQube, jakub...@adspired.com
Hi,

To determine if issues are new, we rely on a comparison with previous analysis from the SonarQube server. If your P/R analysis job is misconfigured (for example wrong sonar.projectKey, or wrong sonar.branch) the P/R will be considered as full of new code, and so all issues will be considered as new.

Check in scanner logs for the string "Load server issues". If you don't see it then it means no previous analysis was used as comparison, and it explains why all issues are reported as new.

++

Julien

jakub...@adspired.com

unread,
May 8, 2017, 7:56:24 AM5/8/17
to SonarQube, jakub...@adspired.com
Hi, 
sorry for the very late replay but indeed that was a problem. 
My project keys did change and I haven't run a normal analysis to load all the so far existing violations into sonar. 
Running the analysis solved the problem. On PRs only new violations are detected.

Thanks 
Kuba
Reply all
Reply to author
Forward
0 new messages