Monorepo Code Coverage setup in sonarcloud

I have a huge monorepo.

the view i want to achieve is:

  1. Monorepo project on sonarcloud which will show the overall coverage for this entire repo
  2. Under this monorepo, I want to have the the domain teams as sub projects where each of these sub projects shows coverage for their owned modules only
  3. Under each of these teams, I want to have each module show as sub project and each of it showing coverage for that service/module.

Any suggestions?


You’ll need to choose:

  • analyze the whole thing as one project and get unified coverage
  • analyze each domain as a project and get team-level coverage
  • analyze each module as a project and get project-level coverage

To get what you’re asking for, you would need to analyze all three ways, but that would be 3x the cost.

I should note that commercial editions of SonarQube offer aggregation, which would address this, but that’s not available in SonarCloud.


I see. Would having the monorepo setup on sonarcloud address this?


Monorepo configuration allows you to analyze multiple projects in the same repo without PR analyses walking over each other.


Hello Jigish,

Thank you for your insight.

May I know why you need to see the overall coverage for the entire monorepo?

Wouldn’t it be enough if you could filter the list of projects per monorepo and see the coverages of each project within the monorepo?

@Ilham Because our existing coverage is low, we want to be able to track the progress we are making at monorepo root level, org level and individual module level

TBH I am little surprised that this use case isn’t common as lot of companies are in similar boat when it comes to monorepo and I assumed that hierarchical views would be of great help.

Hi @Jigish_Mehta,

We plan to introduce portfolio-level reporting to SonarCloud which might eventually help in this area.
You’ll find a card here where you can share more about your needs and that you can follow.

Can you please tell us more about your tracking needs at the organization level and how you would use such information?


G Ann Cambell (sorry I’m a new user and can’t tag) We’re currently using SonarCloud and a rush monorepo with Typescript. From what I understand I need to send coverage results individually to Sonar for analysis. Is that right? What I’ve done is use the matrix feature of GitHub Actions to search for files and extract sonar.projectKey and the folder location of the file. With rush I can execute commands across the monorepo so I can generate all of the coverage with one command but then I use the matrix to upload each project’s result to Sonar. My only issue is the results card from Sonar doesn’t include the projectKey so its hard to know which project each card belongs to. Is there a way to include the project name or key in the results card?

Hi @Roman_Dvoskin

Welcome to the community!

Please create a new thread with all your details.


1 Like

I re-posted here