Monorepo and SonarQube?

Using:
Sonarqube developer 8.6.0.39681 (trial)
Sonarqube extension 4.17.0
VS TFS 2018 Version 16.131.27701.1 (on-premises)

Just succeeded with a running Sonarqube and analyze by c-family wrapper and powershell script see topic.

But I find that it analyzes all of my repo and not just the solution. Not fit for a monorepo. Tried setting Sources directory root to solution folder but all I get is:

##[error]java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0
C/C++/Objective-C files were analyzed. Please make sure that:
* you are using the latest version of the build-wrapper and the CFamily analyzer
* you are correctly invoking the scanner with correct configuration
* your compiler is supported
* you are wrapping your build correctly
* you are wrapping a full/clean build
* you are providing the path to the correct build-wrapper output directory
* you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps

Thats ones thing, but another is if I can even use SonarQube when I have a monorepo? Should I wait for 8.7? Or are there a reasonable way to use it in the meantime?

Hello @Zer0ne,

I think there’s a misunderstanding on what we mean by supporting monorepos.
Generally speaking our understanding of monorepos is that they are a collection of separate projects that can be built separately, but are in the same SCM repository to better manage dependencies between projects (avoid dependency hell).

Currently, with SonarQube you can already analyze projects in a same monorepo. The right way is to split the analysis of the (relatively) independent projects as separate projects in SonarQube (each component of the monorepo that can be built independently=1 independent scanner run=1 project in SonarQube)
When we have a problem is specifically on pull request decoration. Currently each successive PR analysis of the same PR (but from different components of the monorepo) overwrite the findings of the previous one. This is not suitable because you probably have developers working on different areas of the same PR in the monorepo.

So for us, the support of mono repo means that every constituent (sub)project (that is analyzed independently of the rest) of a mono repo will decorate its “piece” of the PR without overwriting the decoration of another piece of work in the same PR of another (sub)project

Does that make sense?

As you properly stated, the above described capability is not yet available in SonarQube 8.6, it should come soon (with 8.7 normally)

Based on that info my conclusion is that 8.7 will solve a problem I will hit, but haven’t yet, since I don’t even have a functional setup yet. Hopefully our discussion in the other thread will solve that.

It won’t fix your problems, it is for enterprise edition only.

Thanks nice to know, but then again if important problems can be fixed by paying more, then so be it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.