BitBucket + Sonar + Jenkins, working with PRs

We have jenkins + bitbucked integration and sonarqube for T-SQL analyze. We have master branch and release branches for every release. Developers make PR to release branch for new features.

We scanned master branch with Sonar. When someone makes PR for release branch SQ scans whole branch, not only PR changes. Can you share an examples how to fix this?

Hello @Vladimir_Bondarev
thanks for positing your question here, and sorry for the delay answering to it.

If I understood your question, you have your T-SQL bitbucket projects integrated with Jenkins for automated analysis and you’d like to optimize this integration by preventing a ‘double’ analysis of the feature branches that are also filed as PRs, is that correct?

You did not tell but I will assume that you have the recommended setup for your projects with a Jenkins multi-branch pipeline and Bitbucket Branch Source plugin (2.7+) used for bitbucket integration. In that case, your Jenkins pipeline configuration is showing you the needed option as a Discover Branches strategy:

This information is also provided to you by SonarQube on-boarding UI at each project creation:

Let me know if this helps.
Best regards

We’ll try, thanks