Can sonar read multiple coverage reports with different languages from one project

Must-share information (formatted with Markdown):

  • Sonarqube 9.4.0.54424
  • Read C# Coverage and TyperScript Coverage in one Analyze Job
  • added properties for TypeScript and C#

extraProperties: |
sonar.scm.exclusions.disabled
sonar.language=csharp
sonar.log.level=INFO
sonar.verbose=true
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)***.trx
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)*\coverage.opencover.xml
sonar.javascript.lcov.reportPaths=$(Agent.TempDirectory)*\Capo.UI\coverage\lcov.info

All I could see the C# Coverage read, but nothing related to the typescript

Is folder structure a problem here which has a dot in the name ? " Capo.UI "

2022-04-08T19:41:01.2806339Z 14:41:01.275 DEBUG: ‘JavaScript analysis’ skipped because there is no related file in current project
2022-04-08T19:41:01.2806776Z 14:41:01.275 DEBUG: ‘TypeScript analysis’ skipped because there is no related file in current project
2022-04-08T19:41:01.2810458Z 14:41:01.275 DEBUG: ‘JavaScript/TypeScript Coverage’ skipped because there is no related file in current project

Hello @bheemreddy181,

  1. The dot in the directory name should not disturb the scanner, you should be fine with *Capo.UI
  2. Your analysis properties have several inconsistencies which are likely to affect
  • Every line should be of the format <settingKey>=<settingValue>
    So you should set sonar.scm.exclusions.disabled=true (although setting to true is not recommended)
  • You should not set sonar.language, this setting is invalid (languages can be multiple and are now autodetected without specifying explicitly)
  • You should chose between sonar.verbose=true (shortcut to sonar.log.level=DEBUG) and sonar.log.level=INFO but not use both
  • Unlike for TRX test reports, coverage report paths can’t be wildcarded, you have to comma separate all the full report file paths (and paths can be relative so the $(Agent.TempDirectory) prefix is probably not needed (and \ and / are equivalent)
     sonar.cs.opencover.reportsPaths=<dir1>/coverage.opencover.xml, <dir2>/coverage.opencover.xml, ...
     sonar.javascript.lcov.reportPaths=<dir1>\Capo.UI\coverage\lcov.info, <dir2>/Capo.UI\coverage\lcov.info, ...

Now, before all the above bring results you have to make sure that JavaScript and TypeScript code is analyzed. For projects that are mix of .Net framework code (C#, VB.Net) and other languages you may have to configure your project to include the other languages. Please read this documentation for this

Olivier

Are you really sure on the wild card patterns from what i see on the logs the patterns are working fine.


Updated Configuration still facing same issue.

full log link sonarlog.txt - Google Drive

Updated Configuration still facing same issue.

Please read my full post, particularly the end:

Now, before all the above bring results you have to make sure that JavaScript and TypeScript code is analyzed. For projects that are mix of .Net framework code (C#, VB.Net) and other languages you may have to configure your project to include the other languages. Please read this documentation for this

Did you read the docs I was pointing to? Is your configuration aligned with the doc requirements?

Added those changes as well

Yes it is aligned with configuration as documented

We found a solution for this from here Scanner should allow to analyze loose .js/.ts files easily · Issue #443 · SonarSource/sonar-scanner-msbuild · GitHub

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