The documentation (the one I found) doesn’t say if/how we can get different badges for “New Code” and “Overall Code”. The one we get now is only for “New Code” which limits its usefulness for me. I can’t can’t slap it onto a repository if it doesn’t reflect the repositories released state but one of the - potentially many - active branches. Whoever last executed the scanner and pushed results defines what the badge says.
You can get a badge for Quality Gate status. It’s up to you if you want the Quality Gate to reflect the status of only New Code (the default) or also Overall Code (possible to configure). It sounds like you might want to customize your Quality Gate.
That sounds a bit like a governance issue. You might consider who has “Execute Analysis” permission for the project; if you’re using a centralized CI system, many customer restrict analysis to only a service account used from within CI pipelines.
That wouldn’t address the issue. I am considering setups where SQ analysis is built into the build pipeline(s).
For project P there might be branches B and C. Once the pipeline for B finishes the badge reflects the Quality Gate for the change set in B. If the pipeline for C finishes a minute later the badge might change with it. So, even if you somehow display the badge in the context of your pipelines - rather then the project - this is misleading.
I (now) understand the correlation between the badge and the Quality Gate. Also, IMO it makes sense to have the default Quality Gate focus on the new code by default. That, however, limits the usefulness of the badge. I feel it would still make sense to have a badge for the Overall Code status regardless of what the Quality Gate prioritizes.
Ah, I see your concern; so you’re analyzing branches of your project in such a fashion that the next analysis “replaces” the result for the overall project dashboard. This is the reason the badges don’t make sense for you.
If you can consider an upgrade to at least SonarQube Developer Edition, you can get proper support for project branches; in this case you would be able to pull a badge specific to the analysis status of the particular branch.
Thanks for your feedback again but maybe we’re still talking past one another.
Well, I’m not sure if you can call it “you’re analyzing … in such a fashion”. Isn’t this the default behavior in the Community Edition? The New Code dashboard just displays the last analysis regardless of which branch, tag, pull-request, etc. the change set in question came from. The analysis N+1 replaces analysis N in branch B and so does analysis M in branch C.
Based on what I see and your explanations there’s nothing unique about our setup - it’s just how the Community Edition works by default (badge is for Quality Gate, default Quality Gate being New Code). If I need a badge to describe the Overall Code of my project, ignoring any New Code not yet merged into the main line, I’m out of luck.