SonarQube Branch analysis / Leak Period

fix_the_leak
sonarqube
branches

(Vardhaman Jain) #1

Must-share information (formatted with Markdown):

  • SonarQube - * Version 7.1 (build 11001) , Jenkins ver. 2.121.3] , Docker version 18.03.1-ce, build 9ee9f40

  • We have a baselined code that we will be the master and run a SonarQube scan on it. So, its version will be BASELINE or 1.0. We need to create a branch which has only the updates on top of the master so that SonarQube only scans the updated code.

  • I have scanned the master code with version 1.0 .I then set the leak period to 1.0. Then I have created a long lived branch(with some changes to the master code) where we set the branch name as per the Regex.
    Ideally, the expectation is the branch should fail the quality gate if modified code has any issues. But the modified code passes the quality gate inspite of having issues and setting the leak period to 1.0.

Is it the right approach ? or am I missing something here.

https://docs.sonarqube.org/display/SONAR/Branch+Analysis does not provide info on the working of branches.


(G Ann Campbell) #2

Hi,

You’re not going to be able to analyze only changed code. All code will be analyzed each time, regardless of which branch we’re talking about.

Long-lived branches have independent New Code periods. The New Code period of master shouldn’t affect your long-lived branch.

It’s difficult to tell you what’s going on here without more details, but hopefully a second look at the situation knowing that each long-lived branch is independent (after initial issue synchronization) should make this clearer.

 
HTH,
Ann


(Vardhaman Jain) #3

Thank you for your reply. Looking at your response, I believe I will need Short lived branches. I have started working on it. Will get back if I have any queries