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!
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!)
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…?