One repo, two projects, different languages

Hello,

We have a single BitBucket repoository which currently contains two projects in separate folders. One for the API (C#) and one for the UI (Angular/TypeScript). The structure is Repo/API and Repo/UI

How can we utilize SonarCloud to run analysis on both of these appropriately and display results for both within BitBucket? The BitBucket repository only seems to allow linking to a single SonarCloud project.

2 Likes

This use case is indeed not very well supported currently. The best option for now would be to link your repo to one SonarCloud project (for instance for the C# part), and to manually create another project in SonarCloud that is not bound to this repo so that you can run the analysis for the other part.

We plan to improve a lot the way we trigger analyses, especially to not heavily depend on the build system. This should allow us to support your configuration out of the box. However, I can’t give you any ETA - we just started discussing about this a couple of weeks ago.

1 Like

Thank you for the response Fabrice. We look forward to the improvements. We had already done the two separate projects in SonarCloud, we’ll just have to remember to manually check one of them to see results.

Hello Fabrice,

This was brought up again in a code review and I thought I’d reach out to see if there was any new information. Thanks!

Hi Frederick!

Nothing has changed so far on the fact that one project must match one repo only.

BTW, can you detail how the 2 projects are built? I guess Repo/API is using MSBuild (since it’s C#), but what about the other one for the UI?

The API is a .Net Core application which is built using dotnet build/dotnet test. The UI is an angular application built with npm run.

OK, so in this context, it’s indeed still not possible to have 1 project only for the 2 parts.

Hello,

I don’t know if that’s what you’re looking for but I was able to have code coverage of an Angular application hosted in an ASP.NET Core web application (TypeScript / C# on same codebase).

Code: https://github.com/devpro/aspnetcore-angular-sample
SonarCloud: https://sonarcloud.io/dashboard?id=devpro.demo.angular-aspnetcore

It was not easy as first this is why I blogged about it (https://blog-bertrand-thomas.devpro.fr/2019/02/03/create-angular-asp-net-core-application-push-azure/).

Please let me know if you would like to try this approach.

Bertrand

2 Likes

Very interesting @devpro, thanks for the link! :slight_smile:

1 Like

Hi @Fabrice_Bellingard, we’re considering to migrate to SonarCloud and I was wondering whether there is an update on this topic. Thanks!

Hello @meck93, and welcome to our community :slight_smile:

We’re about to start an experiment to support multi-scan analyses on SonarCloud (MMF-2002), so that it’s possible to have one repo with multi-languages which map to only one SonarCloud project.

3 Likes

Hi @Fabrice_Bellingard, thanks a lot for the fast feedback! We’re looking forward to this feature!

Thank you @Fabrice_Bellingard (as usual :slight_smile:). It’s funny I had similar question on my blog article this morning.

I can confirm it works fine with .NET C# and TypeScript with no effort, just config, but anything to help use this great tool will be appreciated!

1 Like