SonarQube places develop analysis with main branch analysis

  • Version: SonarQube 9.9 Developer edition
  • Using Azure Pipeline with SonarQubePrepare@5 and SonarQubeAnalyze@5

A while ago we changed branch names from ‘master’ and ‘development’ to ‘main’ and ‘develop’ respectively. Previously, the analysis would be placed with the correct branch, but now the analysis for develop gets listed together with the main analysis so it looks like it’s all on the same branch including the graphs for number of code smells, code coverage and so on.

No new analysis data shows up for the develop branch.

I’ve updated the settings in General->Housekeeping as well as the one for keeping branches, but it doesn’t help.

The SQ tasks in the pipeline look like so:

- task: SonarQubePrepare@5
  condition: eq(variables['SonarQubeAnalysis'], 'true')
  displayName: 'Prepare analysis on SonarQube'
    SonarQube: 'SonarFoss'
    scannerMode: 'MSBuild'
    projectKey: '$(Project.Key)'
    projectName: '$(Project.Name)'
    projectVersion: '$(ProjectVersion)'
    extraProperties: |


 - task: SonarQubeAnalyze@5
   condition: and(succeeded(),eq(variables['SonarQubeAnalysis'], 'true'))
   displayName: 'Run Code Analysis'
 - task: SonarQubePublish@5
   condition: and(succeeded(),eq(variables['SonarQubeAnalysis'], 'true'))
   displayName: 'Publish Quality Gate Result'
     pollingTimeoutSec: '300'

The analysis log is probably too long to post here, but the prepare log looks like this:

Starting: Prepare analysis on SonarQube
Task         : Prepare Analysis Configuration
Description  : Prepare SonarQube analysis configuration
Version      : 5.19.0
Author       : sonarsource
Help         : Version: 5.19.0. [More Information](
C:\work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.19.0\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe begin /k:Foo-Client
SonarScanner for MSBuild 5.15
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
13:03:09.349  Updating build integration targets...
13:03:09.579  Fetching analysis configuration settings...
13:03:09.964  Provisioning analyzer assemblies for cs...
13:03:09.964  Installing required Roslyn analyzers...
13:03:09.964  Processing plugin: csharp version
13:03:10.089  Processing plugin: vbnet version
13:03:10.089  Processing plugin: securitycsharpfrontend version
13:03:10.214  Provisioning analyzer assemblies for vbnet...
13:03:10.214  Installing required Roslyn analyzers...
13:03:10.214  Processing plugin: csharp version
13:03:10.214  Processing plugin: vbnet version
13:03:10.235  Incremental PR analysis: Base branch parameter was not provided.
13:03:10.235  Cache data is empty. A full analysis will be performed.
13:03:10.275  Pre-processing succeeded.
Finishing: Prepare analysis on SonarQube

Hey there.

Which branch is set as your default branch in Azure DevOps?


that’s develop. However, we prefer it that way so pull requests default to develop.

But is that the reason?

Update: I tried setting the branch name for non-PRs in our azure pipeline, but when building develop that only resulted in a new branch in the sonarqube called ‘develop’ including quotation marks, so the overview had both develop and ‘develop’

Then I deleted those branches and renamed main to develop in sonarqube. That seems to have done the trick.

It’s not clear from the documentation that this should be the solution or why this works, but I can see from other discussions that sonarqube maintains internal branch state in some obscure way.

Thanks for the update. This has been improved in the v10.x series of SonarQube where the main branch can be changed via the UI.