Most common configuration for multiple languages

Hi everyone,

I am new to SonarQube and I would like some advice. I have several projects across different repositories. For me, this is a clear relation of 1 repository = 1 project in sonar.

Each of these projects has the following folder structure:
/frontend (Angular project)
/backend (.NET project)

That’s where I’m lost. Is it possible to run multiple runners and have their results aggregated? Or would it be best if I created 2 sonar projects for each repository? One for the Angular part other for the donet?

What is the best practices in such cases?

Thanks in advance :slight_smile:
Rodrigo

HI Rodrigo,

Typescript/JavaScript and C# you can analyze in one project. Both parts needs to be build between SonarQubePrepare and SonarQubeAnalyze.

Only test run and publishing test results between these steps will be visible in SonarQube. Don’t rely on the number of tests in this case, with Sdk-style csproj, old csproj files and npm builds the number is in most cases not ok, but you can see the code coverage. Maybe if the tests would be in reorderd the reorted number would be better, but this was not important for me up to now.

For other combinations of languages I failed to get the results in one SonarQube project: neither Java (Gradle) and .NET nor Java and C++. In these cases I use separate projects.

1 Like

Hi,

FYI @milbrandt several years ago I wanted to analyze C# and Java (among others) into the same project. I was able to do it using the <Content Include... method described in the docs. Maybe that wouldn’t be necessary today.

 
FWIW,
Ann

Hi @ganncamp

that might be true to purely analyze the Java source. But then you still need to compile and run the tests. For sure, not impossible, but not the standard tasks in Azure DevOps to compile and test Java.

For me, the two parts could be split and integration tests between language moduls were running on a separate system, thus not reported to SonarQube anyway :frowning:

It is also possible to compile C# or C+ with Gradle (for C++ we did that), but better and faster results on the build server were the parallel jobs in the pipeline.

1 Like

Hi,

IIRC I did something like:

  • build Java (mvn ...)
  • build C & C++
  • start
  • build C#
  • end

Full disclosure: I didn’t run any tests. It was an internal project meant purely to see if the rules were finding the issues we expected them to.

 
Ann

Hi @ganncamp

that remembered me on an old thread Analyze project with Java, C++ and C# in Azure DevOps where you added this solution later on, while you colleague proposed “a SQ project for each technology stack.”

1 Like

Thanks everyone for the comments. That was very insightful and I’ll give it a try this way.

1 Like