mibexsoftware / sonar-bitbucket-plugin

SonarQube plug-in to create pull request comments for found issues in Bitbucket Cloud
Other
122 stars 72 forks source link

Issues found on existing files not generating comments on PR #51

Open amrara opened 7 years ago

amrara commented 7 years ago

Hi, I'm experiencing following issue: pull request for new branch is created, one class is added with some bad code (that will surely trigger MAJOR issue) and in one already existing file, one line of code was added, that should trigger issue. In this scenario, I'm not getting comment for issue on existing file, but just comment for issues found on new file. Here's snippet of log file (referencing this part where problem is actually found).

diff --git a//src/main/java/com/-/sharedstep/DocumentDownloader.java b//src/main/java/com/-/sharedstep/DocumentDownloader.java index f12be01..f7859d4 100644 --- a//-/src/main/java/com/-/sharedstep/DocumentDownloader.java +++ b//-/src/main/java/com/-/sharedstep/DocumentDownloader.java @@ -12,0 +13 @@ public class DocumentDownloader implements IDocumentDownloader {

08:53:53.831 DEBUG: [sonar4bitbucket] Found 1 issues and 1 of them are new: 08:53:53.831 DEBUG: [sonar4bitbucket] - com..-:-src/main/java/com/-/sharedstep/DocumentDownloader.java:1: Unused field: com.-.sharedstep.DocumentDownloader.listOfStrings 08:53:53.831 DEBUG: [sonar4bitbucket] And 0 of these are on changed or new lines: 08:53:53.831 DEBUG: [sonar4bitbucket] Found 0 existing inline comments: Jun 06, 2017 8:53:53 AM com.sun.jersey.api.client.filter.LoggingFilter log INFO: 8 Client out-bound request 8 > DELETE https://bitbucket.org/api/1.0/repositories/****/121/comments/### 8 > Authorization: Bearer ****

Do you have any suggestion, @mrueegg ? If you need any more info, please let me know.

Thanks!

mrueegg commented 7 years ago

Hi @amrara

Thanks for the bug report. Could you please also show me the existing file where you added an issue? A screen shot of the pull request diff would help me much.

amrara commented 7 years ago

Hi @mrueegg, sorry for the late response. Please see attached screenshot. pullrequestdiff

amrara commented 7 years ago

@mrueegg Update on issue: So, it seems like it's commenting on existing files, but only on those lines with severity=INFO. As for the newly added files, it's seems like commenting only greater than > INFO. I'm really confused now. Please see attached pull request diff's: As for configuration, I have severity set as follows: -Dsonar.bitbucket.minSeverity=INFO

And also, on both files there should be 2 comments. but it seems like I'm getting only one. For existing file, only severity=info, for added file severity=major

pullrequestdiffaddedfile updatedfilepullrequest

mrueegg commented 7 years ago

@amrara Thanks for the screen shots! Could you please also attach the build log for this analysis with debug logging enabled? That would help me much!

amrara commented 7 years ago

Hi @mrueegg, so I yesterday actually I've got the comments triggering for all issues.. So I was testing INFO severity with rule unused field, something like this: private int start; And it was not triggering for that on existing files, but on new ones it did. So I looked thoroughly into our sonar qube quality rules and saw that some of the teammates set up this rule as false positive. So when I used different code that will trigger info severity, it worked all good. I assume that was the main cause- rule reported as false positive will not be triggered?

mrueegg commented 7 years ago

@amrara I'm not sure. Actually, marking an issue as a false positive should only prevent Sonar from creating the same issue on the same line again when analyzing the code. But if the same type of issue occurs in different places on existing files, it should show up anyway. Is that the case?

amrara commented 7 years ago

Yes, issue is reported as false positive on different file. Other info issues works as I can see as expected. Let me know if you need additional details or logs.