gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 207 forks source link

Inline comments do not work #102

Closed artembelousov closed 6 years ago

artembelousov commented 6 years ago

Hello,

first of all, thanks a lot for your plugin.

Sorry, if this was already discussed, but I found no solution or discussion here.

I'm trying to configure SonarQube + sonar-gitlab-plugin + gometalinter (via sonar-golang), and everything seems to work fine, but inline comments are not published to GitLab commits . The global comment is fine - it includes all the issues, the links to the lines work fine, but inline comments are not shown at all.

I'm using the SonarQube via sonar-scanner (no matter from GitLab CI or via direct call), the command is the following: sonar-scanner -Dsonar.host.url=<url> -Dsonar.login=<login> -Dsonar.analysis.mode=preview -Dsonar.gitlab.commit_sha=<sha> -Dsonar.gitlab.ref_name=<ref>

The settings in SonarQube also look fine, they are mostly default (except URL/user token, plus I have switched on "All issues" and "Comment when no new issue" and changed GitLab API Version to v4). Plugin version is 2.1.0.

What can be the problem? What am I doing wrong?

Thanks in advance, Artem

gabrie-allaigre commented 6 years ago

Hi, Thanks,

Verify if sha is correct and if exist issues in commit code ?

artembelousov commented 6 years ago

Yes, sha is correct, global comment is attached to commit. It is also taken from GitLab CI variable, so it must be correct.

But you are right, it seems that the problem was that issues were not exactly on commit code. Strangely enough, I have tried to commit some code with issues previously and didn't get any inline comments, but now it seems to be working. Probably something else was configured incorrectly that time.

Sorry for bothering you and thanks a lot for your help.

padmiv commented 5 years ago

Hi facing the same issue but setup is like gitlab MR triggers jenkins jobs and jenkins pipeline script has sonar scanner command which in-turn provides analysis via sonar-gilab plugin and i have set all the same variables. But not getting the issues as inline comments. getRevisionForLine not found is what i m getting in the jenkins console logs. Can you please help.

@artembelousov Please help

artembelousov commented 5 years ago

Sorry, it was long ago and even that time I did not actually understand what exactly have solved the problem. Also currently I don't use this setup anymore, so unfortunately I cannot really help you.