We are currently using SonarQube 10.6 (zip) and SonarScanner for MSBuild 6.2.
We are trying to have a PR analysis, which is fast and focuses only on changed files. We regularily run full analysis agains the target branch (develop). We get the analysis working, however it is unexpected show especially for minimal changes. It seemingly does not only analyze the changed files in the PR, but all files of the solution.
On SonarQubePrepare Step we can see the following:
- D:\Work\CI_AGENT_3_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\6.3.2\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe begin /k:Therefore-Complete
SonarScanner for MSBuild 6.2
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories…
09:44:40.093 Updating build integration targets…
09:44:40.47 Fetching analysis configuration settings…
09:44:41.003 Provisioning analyzer assemblies for cs…
09:44:41.003 Installing required Roslyn analyzers…
09:44:41.003 Processing plugin: csharp version 9.27.0.93347
09:44:41.018 Processing plugin: vbnet version 9.27.0.93347
09:44:41.034 Processing plugin: securitycsharpfrontend version 10.6.0.31509
09:44:41.221 Provisioning analyzer assemblies for vbnet…
09:44:41.221 Installing required Roslyn analyzers…
09:44:41.221 Processing plugin: csharp version 9.27.0.93347
09:44:41.221 Processing plugin: vbnet version 9.27.0.93347
09:44:41.238 Downloading cache. Project key: Therefore-Complete, branch: develop.
09:44:44.524 Incremental PR analysis: 148 files out of 5571 are unchanged.
09:44:44.586 Pre-processing succeeded.
Finishing: SonarQubePrepare
Especially the line “09:44:44.524 Incremental PR analysis: 148 files out of 5571 are unchanged.” reads strange to us as the PR contains exactly 1(!!) changed files. Is there anything wrong here with the detection of changes in the PR?
We then run our build with build wrapper and finally go to SonarQubeAnalysis. Here we almost see no cache hits, even though as mentioned only one file changed.
At the end of SonarQubeAnalysis we see some warnings - maybe those might give a hint?
INFO: SCM Publisher 1 source file to be analyzed
WARN: Shallow clone detected, no blame information will be provided. You can convert to non-shallow with ‘git fetch --unshallow’.
INFO: SCM Publisher 0/1 source files have been analyzed (done) | time=16ms
WARN: Missing blame information for the following files:
WARN: * Administration/TheDesigner/ADOSDesignerView.cpp
WARN: This may lead to missing/broken features in SonarQube
INFO: CPD Executor 308 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 4044 files
INFO: CPD Executor CPD calculation finished (done) | time=4462ms
INFO: SCM revision ID ‘1c1ee667981133782c9598cd96bf741f65044a4f’
INFO: SCM writing changed lines
WARN: Could not find ref ‘develop’ in refs/heads, refs/remotes, refs/remotes/upstream or refs/remotes/origin
INFO: SCM writing changed lines (done) | time=15ms
Any idea what we can check/look for to make the (incremental) PR analysis work as expected? What can we check for? What to try/test?
Thanks!