sonar-gitlab-plugin icon indicating copy to clipboard operation
sonar-gitlab-plugin copied to clipboard

SonarQube line comments are not displayed in diff view

Open johnou opened this issue 8 years ago • 43 comments

When viewing a merge request in diff view the SonarQube comments are not displayed, is there maybe a bug with how the comment is added or a different API endpoint / field for having the comment in the diff view? cc. @gabrie-allaigre

johnou avatar Mar 02 '17 14:03 johnou

@jairbubbles do you see the same behaviour?

johnou avatar Mar 02 '17 19:03 johnou

@johnou No but I do not have the same exact version. I use a version from a fork which uses the new GitLab API. Maybe it's linked ? (I don't remember the name of the fork, I'm not at work so I can't tell you which one) Which GitLab version do you use ? For me it's 8.17.

jairbubbles avatar Mar 02 '17 20:03 jairbubbles

@jairbubbles we are currently on GitLab 8.16.5-ee, SonarQube 6.2. I will look through the forks soon, could I trouble you for the jar?

johnou avatar Mar 02 '17 20:03 johnou

@johnou I'll give you all the info tomorrow when I'm at work!

jairbubbles avatar Mar 02 '17 20:03 jairbubbles

Hi, It not same comment in side by side merge request. https://gitlab.com/gitlab-org/gitlab-ce/issues/14850

gabrie-allaigre avatar Mar 02 '17 21:03 gabrie-allaigre

@johnou I forked this repo https://github.com/Jojo255/sonar-gitlab-plugin

jairbubbles avatar Mar 03 '17 11:03 jairbubbles

@jairbubbles haha they made the same mistake as me, the GitLab API plugin they swapped to isn't the official 😆 can you double check that comments come up in the diff? According to the issue @gabrie-allaigre linked to it should not be possible since the API doesn't exist..

johnou avatar Mar 03 '17 11:03 johnou

@johnou I had a screenshot to prove you it work but I lost it and now I can't see the comment anymore. New commits were made on the MR so that might explain why it's not there anymore.

jairbubbles avatar Mar 03 '17 11:03 jairbubbles

@johnou If I go back to a previous version I get the message: image

@gabrie-allaigre https://github.com/kakawait/sonar-gitlab-plugin seems quite active should be great to merge with both forks isn't it ? Why not put it on https://github.com/SonarQubeCommunity ? It seems to be the place for such plugins.

jairbubbles avatar Mar 03 '17 11:03 jairbubbles

@jairbubbles see https://github.com/gabrie-allaigre/sonar-gitlab-plugin/pull/13#issuecomment-283326111

johnou avatar Mar 03 '17 11:03 johnou

@johnou Not sure I follow you. https://github.com/SonarSource != https://github.com/SonarQubeCommunity

jairbubbles avatar Mar 03 '17 19:03 jairbubbles

@jairbubbles yep but that org is for the update center Simon mentions, right?

johnou avatar Mar 03 '17 20:03 johnou

@johnou It seems so yes. Having a central depot in SonarqubeCommunity would be a first step I guess to make it an official plugin.

jairbubbles avatar Mar 03 '17 20:03 jairbubbles

@jairbubbles My goal is to have the plugin on sonar directly. But I add functionnaly (multi hash) and test for code cover. https://sonarqube.com/dashboard?id=com.talanlabs%3Asonar-gitlab-plugin

Also my other plugin https://github.com/gabrie-allaigre/sonar-auth-gitlab-plugin

gabrie-allaigre avatar Mar 04 '17 08:03 gabrie-allaigre

@gabrie-allaigre That's even better! Thx anyway for making the plugin in the first place.

jairbubbles avatar Mar 04 '17 14:03 jairbubbles

@gabrie-allaigre multi hash?

johnou avatar Mar 06 '17 09:03 johnou

@johnou In Git, when you push, there are several commit. Currently I have only the last commit, the multi hash is to take all the commits of the branch and to comment inline.

gabrie-allaigre avatar Mar 06 '17 09:03 gabrie-allaigre

@gabrie-allaigre again, little off topic but do you know if a lot of people use old version of Sonar? I recall seeing a comment saying there was a file cache hack which could be removed after updating to latest Sonar API. Maybe after implementing multi-hash you could create a branch then bump the major version and only support latest Sonar wdyt?

johnou avatar Mar 06 '17 09:03 johnou

@johnou File cache hack is already deleting in new version 2.0.0. It's for sonarqube >= 5.6. For older sonar versions, use version 1.7.0

gabrie-allaigre avatar Mar 06 '17 09:03 gabrie-allaigre

I don't want to be a competitor, but I've implemented multi-hashes support on a fork (https://github.com/kakawait/sonar-gitlab-plugin).

I don't think I can create a MR because code base is now completely different (rewritten for JDK8 + official Gitlab lib) but feel free to look at if you want

kakawait avatar Mar 06 '17 10:03 kakawait

@kakawait, Yes thanks, I add functionnality.I will change for GitLabAPI when it will have integrated my MR on the proxy support.

gabrie-allaigre avatar Mar 06 '17 10:03 gabrie-allaigre

Maybe off-topic too but GitLab also have a issue about commenting MR (I mean revision part of MR), see open issue https://gitlab.com/gitlab-org/gitlab-ce/issues/26606

Thus on our current GitLab version that code does not work as expected https://github.com/gabrie-allaigre/sonar-gitlab-plugin/blob/master/src/main/java/com/talanlabs/sonar/plugins/gitlab/CommitFacade.java#L94 (due to GitLab bug is not bug from plugin itself)

kakawait avatar Mar 06 '17 12:03 kakawait

@gabrie-allaigre still working on multi-hash or is it already in master?

johnou avatar Mar 09 '17 17:03 johnou

@johnou yes work in progress on multi-hash. Multi-hash will be just one more option

gabrie-allaigre avatar Mar 10 '17 08:03 gabrie-allaigre

@johnou multi-hash is done on master

gabrie-allaigre avatar Mar 18 '17 11:03 gabrie-allaigre

@gabrie-allaigre sweet, I'll test it out on Monday!

johnou avatar Mar 18 '17 21:03 johnou

@gabrie-allaigre I tried out multi-hash with a feature branch and multiple commits, what I found is that if the first commit contains a blocker issue which has been resolved in the following commit it may still result in the build to failing.

johnou avatar Mar 20 '17 10:03 johnou

@kakawait did you run into the same issue with your branch / multi-hash implementation?

johnou avatar Mar 20 '17 10:03 johnou

@johnou SonarQube analyse last commit only, the blocking issue must be in your latest version of the analyzed sources

gabrie-allaigre avatar Mar 20 '17 10:03 gabrie-allaigre

Beware, the multi-hash does not work all the time, Example : 2 commits, A (first), B A : Add file Fake.java with 1 blocker B : Rename file Fake.java -> Fake2.java

SonarQube get 1 blocker issue in Fake2.java Adding a comment on the A commit (Fake.java) will no longer make sense

The same problem with lines added to a file

Example : 2 commits, A (first), B A : Add file Fake.java with 1 blocker (line 10) B : Add in Fake.java 40 new line at the beginning of the file

SonarQube get 1 blocker issue in Fake.java at line 50

gabrie-allaigre avatar Mar 20 '17 11:03 gabrie-allaigre