New Code Analysis - reference branch per branch

Developer Edition
Version 8.4 (build 35506)

Project level settings allow you to configure how “New Code” is calculated (Previous Version, Number of Days, Reference Branch).

You can also configure the setting on a per branch basis.

In order to configure the setting on a branch, the branch must exist, and must therefore have had a scan done. However this means we must do 2 scans with a manual, UI step in the middle in order to get the desired new code analysis. Surely this is not as intended? Is there some property I am missing in order to set this when the first scan is done?

The use case is - “short lived” bugfix branch being scanned using a target release branch as the reference branch to determine new code.

Its a large project and doing the scan twice is really inconvenient (as is manually setting the branch via the UI) and I cannot believe having to do the scan twice is how this feature can have been designed - I must be missing something!

2 Likes

Hi,

Welcome to the community!

I’m looking at 8.7 & the choices are:

  • Previous version - (granted, you don’t have a previous version on first analysis of a new branch)
  • Number of days
  • Specific analysis
  • Reference branch

The only New Code Period setting that wouldn’t be durable across branches is ‘Specific analysis’.

Could you share more details about your use case? Because for new branches the New Code Period should default to the project-level setting.

 
Ann

Hi,

Project level settings is not appropriate because in our case, we want to use a “Reference Branch” that is potentially different for each short lived branch.

The use case in more detail is;

“Project Setting” is “Reference Branch : Develop”.
We have several long lived branches (maintenance branches)
release/100
release/105
release/106

We have bugfix branches to each of those maintenance branches
bugfix/106/JIRA-XYZ → this should compare against release/106 for the purpose of new code analysis

bugfix/105/JIRA-123 → this should compare against release/105 for the purpose of new code analysis

bugfix/dev/JIRA-ABC → this is fine to use the project defaults which is compare against develop

For bugfix/106/JIRA-XYZ I would have to do a scan using the project settings. Manually change in the UI to override the reference branch to release/106. Then do another scan. This is obviously less than ideal, when a property passed in to override the project settings would be so much easier - as part of the first scan? It doesn’t make sense that you can override the settings for each branch, but only after you have first done a (useless) analysis using the project level settings (again, maybe I am missing something here and its not a bug at all, but if my developers designed something where I had to do a piece of work in order to throw it away and redo it with different settings, I would consider it a bug!)

1 Like

Hi,

Thanks for sharing your use case. Unfortunately, I don’t have much for you right now except t point out that you can use the web services that underlie the UI to set these values, so maybe an automation step could help…?

And I’m passing this on internally.

 
Ann

Happy to use underlying APIs but I don’t believe I can create a branch this way?

Hi,
same issue here, the missing feature has already been discussed in these threads:

It shouldn’t be that much effort to add a property for this.

Peter

1 Like

Hi @dom54 ,

I’m facing currently the same use case … could you analyze your branch new code only once against other reference branch ?