Multiple Sonar Analyses for a single Github repo

Hello,

I have a project with a single Github repository, including both front-end and back-end, where I trigger two analysis jobs, one for the front, and one for the back, in two different sonar projects with different rules.

My problem is that even if two different analyses are launched, only one is considered in the status checks:

  • front-end analysis is OK : “Sonar Code Analysis” status check is ok.
  • back-end analysis is KO : the merge is not blocked, since the status check is already green.

Is there a pattern for this use case?. If not, maybe simply adding an identifier for the status check, such as “SonarCloud Code Analysis: project-name” would work.

In the same fashion, the bot comments don’t show the name of the project, which is a problem when you have more that one analysis for the repository.

Thanks in advance for any help,

1 Like

Hello @toindev, welcome to the community forum!

Usually the pattern for this use-case is to have only one project on SonarCloud project for your Github repository, which contains for the front and back-end code. This way you would only have to launch one analysis, and there will only be one check reported.

Tom

1 Like

Yes, I understand it is the simplest way to do it, but I need different quality gates for the front and back. All my setup is already working for two separate analyses, and the only problem is the identically named status checks.

Is my suggestion to add an identifier to the status check in Github impractical?

Hi @toindev,
It is true we don’t cover this use case currently. We recognize that there is demand for “single repo, multiple projects” capabilities. This is something we want to work at this year - it is too soon for an ETA or the definition of a solution however.
Alex

1 Like

Just to close the topic, I’ve solved my problem by moving to a single analysis, while excluding some parts of the repo for certain checks using the sonar.properties.

cf, Sonar blog post, “Narrowing the focus”