Closed lopesdasilva closed 7 years ago
Yes, I agree. It seems the entire repo is analyzed even though only a couple of files have been modified. Is there a way to run preview mode only on the few files in the pull request?
The default for running this plug-in is preview mode, which does not store the analysis results on the SonarQube server. The preview mode only analyzes changed files. This is compared against the latest full analysis (published on the SonarQube server).
So when you analyze your master branch on a regular basis with publish mode, when you create a pull request and analyze it with preview mode, preview mode will only analyze the changed files. The more often you analyze your master branch, the better (faster) this will work.
Does that help?
Thanks Michael. It does make sense. What do I supply for the mandatory field sonar.sources? Should it match the sources list that was used to create the sonarqube project? There are problems in the sonarqube project such as not being able to find certain include files. Looks like those problems are still showing up in preview mode?
If a pull request is created for a branch which is new and not analyzed in Sonarqube yet, then how will the 'preview' mode behave? The first analysis takes close to 5 hrs.
Last night, I might have found a work around for this. The job is triggered by the 'Bitbucket Pull requests Builder' plugin which gets the source and target branches. I'm diffing those two to get a list of files which I'm passing as sonar.sources value. Please let me know if you see a problem with this logic.
thanks
From: Michael Rüegg notifications@github.com Sent: Tuesday, May 30, 2017 1:05:06 AM To: mibexsoftware/sonar-bitbucket-plugin Cc: sreeramk08; Comment Subject: Re: [mibexsoftware/sonar-bitbucket-plugin] Setting for checking only new added lines or complete file (#34)
The default for running this plug-in is preview mode, which does not store the analysis results on the SonarQube server. The preview mode only analyzes changed files. This is compared against the latest full analysis (published on the SonarQube server).
So when you analyze your master branch on a regular basis with publish mode, when you create a pull request and analyze it with preview mode, preview mode will only analyze the changed files. The more often you analyze your master branch, the better (faster) this will work.
Does that help?
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/mibexsoftware/sonar-bitbucket-plugin/issues/34#issuecomment-304805091, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABv_6jdBbtGYf1PA7XsrO_lYbQ2YAVO1ks5r-82ygaJpZM4K5M3g.
Thanks for your feedback.
You can restrict the scope of the analysis by providing only the changed files in the pull request for sonar.sources
. That should work AFAIK. But this would only make sense for the persistent mode, the preview mode should only analyze the changed files of your feature branch compared to master anyway (therefore, it is important to keep master up-to-date).
If your analysis takes that long, is it possible that you run a full/persistent analysis??
There should be a setting to set if the sonar analysis should focus only on new/modified lines or the entire file.
Thanks