ciricihq / gitlab-sonar-scanner

This project is no longer maintained
GNU General Public License v3.0
80 stars 62 forks source link

ISSUES mode is somehow buggy, despite the fact it works most of the times #23

Open MuyBien opened 6 years ago

MuyBien commented 6 years ago

Hi! Thanks for this image that save me a lot of time and effort!

But if I manage to connect the docker and the sonar server, it seems that it's analysing all the source files (10min) even in ISSUE mode.

Here is my gitlab-ci job

SonarQube:
  stage: quality
  image: ciricihq/gitlab-sonar-scanner
  variables:
    SONAR_URL: http://sonar.***.***
    SONAR_ANALYSIS_MODE: issues
  script:
  - gitlab-sonar-scanner
  allow_failure: true

and my sonar-project.properties

sonar.sources=.
sonar.java.binaries=*/build
sonar.sourceEncoding=ISO-8859-1

sonar.gitlab.project_id=git@gitlab.***.***:2003/*******/***.git

In the job log it says: INFO: 18831/18831 source files have been analyzed

elboletaire commented 6 years ago

Please tell us your sonarqube version. Also, ensure you have created your gitlab user for creating issues, and that it already has the minimum permissions to write comments.

You should also ensure that you properly set the api key of that user in the sonarqube gitlab configuration tab:

imatge

MuyBien commented 6 years ago

Hi @elboletaire !

SonarQube version : 6.3.0.19869 Yes I created a GitLab user @sonarqube with developer access to the project and I added his token with all rights enable. The account was not verified by the confirmation email 🤔 Maybe it is the problem? I didn't receive the confirmation mail :/

gtrias commented 6 years ago

Hi @MuyBien ,

Can you paste all the gitlab-runner logs?

elboletaire commented 6 years ago

BTW, I think you need to enable that account in order to be able to properly use it. At least the one we're using is enabled; you should give it a try.

elboletaire commented 6 years ago

Closing due to inactivity.

MuyBien commented 6 years ago

Yeah sorry, I will try again later but we have a problem with the activate mail. By the way I can log in with the account and do everything so maybe it's activated. I will reopen this issue when I retry and have more information.

Thanks

MuyBien commented 6 years ago

So here I am again!

I tested to add a comment manually with the SonarQube user I created on GitLab and it works. So the user have the correct rights I supposed.

Another thing I saw, it's I didn't pass any projectKey to the sonar job. So I added that. We have a root directory and inside modules directory. Each module it's a project on SonarQube. So I guess I will have to make a CI job for each SonarQube project (our modules).

So I added a job configured for one SonarQube project (Core) and I added a line with a bug according to our rules, a BigDecimal constrctor non compliant.

Here is the job log: sonar-gitlab-job.log And my sonar-project.properties:

sonar.gitlab.project_id = git@gitlab.domain.com:2003/repo.git
sonar.java.binaries     = **/build,**/Lib*
sonar.projectKey        = com.modulbio.Core:Core
sonar.sourceEncoding    = ISO-8859-1
sonar.sources           = Core/

The job is finished with success but I have a lot of warning "Unable to find the class". I don't know what is the effect of this... It seems to analyse the correct files but the BigDecimal bug it's not founded and therefore no discusion are opened into the correspondant MR.

What can be the problem here? Thanks for any help again!

MuyBien commented 6 years ago

And it's true that it didn't parse only modified file but all the module files. So this can be a problem too

elboletaire commented 6 years ago

Ok now I see what's your problem, but I'm sorry because I think this is nothing related to our gitlab-sonar-scanner docker image. Either seems to be an issue with the gitlab sonarqube's plugin or with sonarqube itself.

We currently have some issues where errors are detected in not modified files, and also I remember more than one time not detecting things that should detect. But I never got enough time to debug this by myself.

If you wanna debug this by yourself, you should try running the plugin locally in your machine (without our docker container), and try start discarding issues from there.

I'm reopening the issue but changing its title, because we also have experienced it, and it would be nice to have it working properly.

BTW, if any of us detects if the issue really comes from the gitlab plugin or from sonarqube, we should scale the issue to them and close this one.

elboletaire commented 6 years ago

Note that I'm adding the despite the fact it works most of the times to the title because you are the only one having this (really) bad experience. If you check the issues section you'll see there are others using this plugin and no one mentioned this before.

MuyBien commented 6 years ago

Thanks for reopening the issue. As you said, it's weird that I'm the only one having issues wit the issues's mode (:trollface:).

Are you sure it's not possible that I made a mistake somewhere?

Thanks for your help!

elboletaire commented 6 years ago

No, I'm not sure, but, as said, I think is related to what happens to us. Anyway, I don't have much time for this. So any help would be appreciated (that's why I added the help wanted badge).

If you can do any checks on your side and share them here, we'll be glad to read them.