Quality gates for different branch In a project

Hi,

I’m using sonarqube developer edition version 8.1

I was just wondering if there is a way to configure different quality gates for each branch in a specific project ? We’re now using the sonarqube recommended quality gate for all of our projects.

Thank you

Hello @fhumera,

Welcome to the SonarSource community. :wave: . I hope you’ll enjoy it
You can configure different quality gates for different projects but you cannot configure different quality gates for different branches of a same projects. We don’t see a use case for that.
If what use case/context would you need to do that ?

Olivier

Thank you for your response Olivier.
I would like to have a different quality gate for the test branches on bitbucket compared to the master branch. Is there a way to configure something like that in sonarqube ?

Farheen

Does it make sense to use a liberal quality gate for test (= feature ?) branches
when i’ll get issues after merging to master and scanning the master branch with
a stricter quality gate !?

Read liberal and stricter as example for different quality gates.

Gilbert

I already understood what you want to do, what I am trying to understand is why you want to do that, which you don’t explain above.

@anon67236913 gave a possible guess.

I am not super convinced by the use case. If you want to be permissive on a branch to test something, then you should not care about failing the quality OR you should analyze the test code as a separate project (use a different sonar.projectKey), where you can use a different quality gate.

So in conclusion, what you want to doe @fhumera is current not possible and we could only consider changing that if we have a good use case demonstrating the relevance of that feature.

This is my first post, so welcome everyone !

I have a scenario for that (and came here looking for solution).
I have one codebase for 3 different devices: A, B, and C.
Each has it’s own branch (this is really long story and solving this mess takes time).
Core part of the code is the same, but there are significant differences in some parts as well.
Since A and B are becoming obsolete we are not planning to invest much time in increasing quality there.
One of the things we did is started calculating coverage, but only for C (which is the newest one).

So I would like to have minimal coverage on Quality Gate, but since I am calculating coverage for C only I want it on C only.
Right now I am trying to make a workaround by threating C as separate project in SQ, but it makes live difficult when it comes to PRs and stuff.

Hello @Mariusz_Dullak,

Although your use case is legitimate, it is very uncommon: different branches with variable status in terms of code coverage implementation. I unfortunately no better solution than having different projects for different branches with different code coverage expectations (and therefore different quality gates)

Olivier

Thanks Olivier.

I hate the way the code is organized, but it will take me at least a year to get things in a more normal way.

best
Mariusz

One of our teams wants to create 2 projects for the same codebase, so that they can have different quality gates, 1 for each push without code coverage as the team wants to have quick results on security and language analysis and 1 for merge requests and run nightly on each branch that includes code coverage (this as the code coverage calculation seems to take quite long for their project).

Are the lines of code then counted twice for the LOC in our enterprise license? Are there any other options to achieve this with the enterprise version of SonarQube?