Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Source code analysis for Monorepo?

I have a Mono repo in which all my Spring boot based micro service reside.

I know how to configure a SonarQube analysis for poly repo but wondering how sonarqube analysis can be done on a monorepo and how Soanarqube can identify different projects inside the mono repo.

Is there a different type of configuration I have to do with Sonarqube ?

like image 461
Spencer Bharath Avatar asked Nov 18 '25 11:11

Spencer Bharath


2 Answers

As said in the comments, monorepo support is available for GitHub and Azure DevOps Services. If your repository is hosted by one of these services, you can import a monorepo with this procedure:

  • Go to the + (plus) menu on the top right of the SonarCloud interface and select Analyze new project.
  • This will take you to the Analyze projects page
  • Now click Setup a monorepo (it is a small text link on the lower right of the page). You will now be on the Import monorepo page.
  • Select the organization and then select the monorepo repository that you want to import.
  • For each project contained in your monorepo, add a corresponding SonarCloud project by clicking "Add new project". You have to choose a unique project key for each SonarCloud project. As mentioned above, these are the keys that you will use when configuring your CI service (see below) to bind each monorepo project to its corresponding SonarCloud project.

Full details in the sonar blog post: Mono-repository support for GitHub and Azure DevOps Services available now!

Note that:

  • there is also a support for Bitbucket : Mono-repository support for Bitbucket Cloud now available for SonarCloud!

  • You can show your interest in a monorepo support for Gitlab to Sonarsource by voting here.

like image 185
Ortomala Lokni Avatar answered Nov 20 '25 01:11

Ortomala Lokni


As of writing SonarQube 9.8 does not mention the word monorepos in their documentation search. So you'd have to create separate projects manually if you are using an on-prem version.

like image 28
Archimedes Trajano Avatar answered Nov 19 '25 23:11

Archimedes Trajano



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!