No Housekeeping for Pull Requests of main branch

Hi there,

regarding to our previous problem with the housekeeping of pull requests and shorted-lived branch, we are now facing a new problem.

The settings for deleting analysis of short-lived branches and pull requests is set to 30.

We have two long-lived branches: master and develop
The only way to push into these is via pull requests.
And the normal process is to create a pull request to merge new code into develop and than create another pull request to merge develop into master.

For the develop branch the housekeeping seems to work, because we don’t have any analysis of pull request older then 30 days.

The problem: for the main branch master the list of pull requests analysis gets longer and longer

Is there anything I can check?

In the sonar context of the background task I can see, that the property is set correctly:

Our environment:

  • SonarQube Version 8.4.1 (build 35646) Developer Edition
  • SonarC# 8.9 (build 19135)
  • Buildsystem: AzureDevOps
  • Database: PostgreSQL 9.5.14


Could you confirm that PRs for merge from develop into master have the correct target branch?

Here’s an example of where you might find this information:


Hi @Philippe_Perrin,

yes, I can confirm:


Could you provide me with:

  1. The value of your sonar.dbcleaner.branchesToKeepWhenInactive setting? Both at instance level and at project level?
  2. The name of the branch behind PR-1018? And in general, the pattern (if any) behind branches you use to merge changes from develop to master?


  1. The value sonar.dbcleaner.branchesToKeepWhenInactive of the master branch is (branch|release|develop|master), for the instance it is

  2. Normally we create a pull request in AzureDevOps from develop into master and name it something like “Merge develop into master”. In our build pipeline we set the following sonar properties for a pull request build:

  • sonar.pullrequest.key -> id of the pull request, e.g. 1018
  • sonar.pullrequest.branch -> source branch of the pull request, in this case develop
  • sonar.pullrequest.base -> target branch of the pull request, in this case master
  • sonar.pullrequest.provider -> always vsts

The property will not be set for pull request build, only for “normal” builds.

Hopefully that are the information you asked for.


Thank you for all the information @s-kip. We managed to reproduce the behavior you described and will come back to you as soon as possible.


1 Like

I’ve opened a ticket to track this issue:, we plan to fix it in version 8.6.


1 Like

Hi @Michal_Duda,

just to be sure that I understand it right: the problem is, that the source branch of the pull requests is part of the branchesToKeepWhenInactive?


Hi @s-kip,
To be fully precise, the problem is the source branch of the pull request was part of the branchesToKeepWhenInactive when the pull request was first analyzed by SonarQube. Changing branchesToKeepWhenInactive now will not purge those stale pull requests that are already in SonarQube, it will only affect new pull requests.

We will fix this problem in 8.6 and the fix will also cleanup affected pull requests. If waiting for 8.6 is not an option, I imagine one workaround would be a combination of changing branchesToKeepWhenInactive and manually removing affected pull requests that were created prior changing this setting.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.