Is it possible to publish results of multiple scan mode as one report in ADO pipeline tasks

Hi,

According this documentation there are 3 scan modes available and specific one need to be used based on the programming language.

csharp - dotnet

maven or Gradle - other

others - cli

SonarQubePrepare@7 - Prepare Analysis Configuration v7 task | Microsoft Learn
Azure DevOps Extension | SonarQube Server | Sonar Documentation

I have a repository that contains both dotnet and angular projects, basically a mono-repo.

Question:

In such scenario can I have 2 Prepare and 2 Analysis tasks and then 1 publish task? Will it capture scans details as a combined report and then publish.
For example, will I get correct coverage results for both projects, summary is cumulative of both scans, etc.

Hi,

Assuming this is one project with both C# and JS, you should use SonarScanner for .NET; it will pick up the other language(s) too.

If it truly is a monorepo - independent projects checked in together - then you would use SS4.NET for the C# project, and either SonarScanner CLI or SonarScanner for NPM for the Angular.

 
HTH,
Ann

Hi @ganncamp

Thanks for the reply, it would be great if you can give a little more info on this exact scenario.

The structure is something like this

  • repo
    • backend - .NET core project
      • src
      • tests
    • frontend - Angular project
      • src
      • tests

Now if I use `csharp - dotnet` mode will it consider code coverage, test report etc for both the projects if I configure both??

If I can configure something like this having both .net and js related properties and 1 single Analyze and Publish task?


- task: SonarQubePrepare@7
          displayName: 'Sonar_Configure'
          inputs:
          SonarQube: 'SonarQube'
          scannerMode: 'dotnet'
          projectKey: 'SONAR_PROJECT_KEY'
          projectName: 'SONAR_PROJECT_KEY'
          projectVersion: 'VERSION'
          extraProperties: |
            sonar.exclusions=**/*.Mocks/*.cs
   
            sonar.cs.vstest.reportsPaths=……./**/*.trx
            sonar.cs.opencover.reportsPaths=…….*/coverage.opencover.xml

            sonar.javascript.lcov.reportPaths=coverage/ngx-teamviewer-ui/lcov-report/lcov.info
            sonar.testExecutionReportPaths=artifacts/unit-test/unit-test-result.xml
            sonar.typescript.tsconfigPath=tsconfig.json

            sonar.qualitygate.wait=true

- task: SonarQubeAnalyze@6
  displayName: 'Coverage_Report_Publish'

- task: SonarQubePublish@6
  displayName: 'Publish Sonar Results'
  inputs:
    pollingTimeoutSec: '300'

Hi,

Yes, it should work to analyze everything together, and your properties look reasonable to me, as shown here.

Let us know if you hit any snags.

 
Ann