SonarQube branch analysis and Leak period

fix_the_leak
branches

(Anand Narayanan) #1

Hello,

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SQ ver : 6.7.3
    sonar-scanner-3.2.0.1227-linux
    branch plugin :1.0 (build 507)
  • what are you trying to achieve

Trying to setup GuideWire (Gosu) analysis with custom plugin and rules.using scanner for 2 types of branches long (master) and short (feature).As GW itself has so many OOTB issues trying to create a baseline version ootb issues ignored.And subsequent analysis of all other branches should generate the differential view (ie the ootb issues in baseline version should be ignored)

  • what have you tried so far to achieve this

Initial analysis run and baseline version created v1.0.set leak period as this
in all subsequent branch analysis setting the sonar.branch.target and sonar.branch.name
But the combination of branch analysis and leak period is not producing the correct output,i see still there are issues getting duplicated

What is the best strategy for achieving this?


(Colin Mueller) #2

Anand,

It sounds to me like you might be creating long-living branches in SonarQube rather than short-lived branches, in which case it would make sense that the issues sync upon brach creation.

Check the “Configuring the Branch Type” section of the Branch Analysis documentation and based on the info there, compare your global/project settings to how your branches get named.

Colin


(Anand Narayanan) #3

Hello Colin,

Thank you for the response.
I have indeed referred the [Branch Analysis documentation] and also the Fixing+the+Water+Leak
Indeed it is creating short-lived branches as i said earlier i am setting the sonar.branch.target and sonar.branch.name.(i can see that in web gui as short-lived)

To clarify my situation

1.Long-lived Branches - “During the first analysis only, issues (type, severity, status, assignee, change log, comments) are synchronized with the Main Branch. In each synchronized issue, a comment is added to the change log of the issue on the long-lived branch: “The issue has been copied from branch ‘master’ to branch yyy”.”

I am not sure if this is happening in my case,every-time there is an analysis i see the same issues getting repeated

2.Short-lived Branches
“The issues visible on the short-lived branch are the new issues corresponding to files modified in the branch.”

Ideally i would have expected after the initial analysis (BASELINE) ,after setting this in the leak period.
All the subsequent analyses will have the delta issues or issues on the modified files,shouldn’t this be the behavior in both long and short (obviously because of “ephemeral nature of short-lived branches…”)?

regards
Anand


(Anand Narayanan) #4

Hello,

After some trail and error,was able to make this scenario work by the following steps.

  1. Set the sonar.branch.longLivedBranches.regex to required ((master|release|development)-.*)
  2. Run the initial analysis without specifying any branch information on the baseline version.this will be the BASELINE or V1.0
  3. Set the leak period as BASELINE or V1.0 (instead of previous_version) in leak period or sonar.leak.period
  4. Set the sonar.branch.target and sonar.branch.name in all subsequent analysis

Not sure if this what is intended from the doc,it was not quite intuitive. :slight_smile:
Thanks again for the support.

regards
Anand