Could not get any cobertura coverage info in SonarQube

  • versions used: AzureDevops Server 2019.1 / SonarQube Community 6.7.7 / Flex Plugin 2.5.1 / Scanner
  • error observed: no cobertura coverage info

Hi, within an Azure Devops Server build Pipeline, a cobertura coverage report is generated (with an ng test --code-coverage=true --sourceMap=false call)

The cobertura report is OK, since coverage info is well displayed within AzureDevopsServer

However, upon calling the sonar scanner, the report parameter (sonar.flex.cobertura.reportPath=./coverage/cobertura-coverage.xml) seems to be ignored, as no mention of cobertura appears with a -X flagged analysis

No path issue though as if I use the generic coverage parameter, it chokes on ill formed xml. I may provide the coverage report if necessary.

According to the Test Coverage documentation it should be:


You forgot to add s at the end (reportPath instead of reportPaths):

1 Like

Hi Adam, good spot, I fixed the propertyname.
Alas, it doesn’t change anything in the analysis behaviour.

At least one form the following lines should appear in you log file:

  1. Analyzing Cobertura report: coverage/cobertura-coverage.xml
  2. Cobertura xml report not found: coverage/cobertura-coverage.xml
  3. No Cobertura report provided (see ‘sonar.flex.cobertura.reportPaths’ property)

Please check which one you have. If no one, then Flex Cobertura sensor is not executed at all.

Here is the source code for version 2.5.1: org.sonar.plugins.flex.cobertura.CoberturaSensor

Hi Adam, thanks for your time, and I can confirm I don’t have any mention of cobertura in the logs with a -X analysis

The only mention of sensor is for PHP, here is an excerpt of the analysis log:

10:13:43.749 INFO: Scanner configuration file: E:\AgtInt\_work\_tasks\SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055\4.8.0\sonar-scanner\bin\..\conf\
10:13:43.749 INFO: Project root configuration file: E:\AgtInt\_work\TestDT\s\
10:13:43.780 INFO: SonarQube Scanner
10:13:43.780 INFO: Java 1.8.0_222 AdoptOpenJDK (64-bit)
10:13:43.780 INFO: Windows Server 2016 10.0 amd64
10:13:43.936 DEBUG: keyStore is : 
10:13:43.936 DEBUG: keyStore type is : jks
10:13:43.936 DEBUG: keyStore provider is : 
10:13:43.936 DEBUG: init keystore
10:13:43.936 DEBUG: init keymanager of type SunX509
10:13:44.061 DEBUG: Create: C:\Users\usr\.sonar\cache
10:13:44.061 INFO: User cache: C:\Users\usr\.sonar\cache
10:13:44.061 DEBUG: Create: C:\Users\usr\.sonar\cache\_tmp
10:13:44.061 DEBUG: Extract sonar-scanner-api-batch in temp...
10:13:44.061 DEBUG: Get bootstrap index...
10:13:44.077 DEBUG: Download: https://mysonar/sonar/batch/index
10:13:44.374 DEBUG: Get bootstrap completed
10:13:44.389 DEBUG: Create isolated classloader...
10:13:44.389 DEBUG: Start temp cleaning...
10:13:44.405 DEBUG: Temp cleaning done
10:13:44.405 DEBUG: Execution getVersion
10:13:44.405 INFO: SonarQube server 6.7.7
10:13:44.405 INFO: Default locale: "en_US", source code encoding: "UTF-8"
10:13:44.405 DEBUG: Work directory: E:\AgtInt\_work\TestDT\s\.scannerwork
10:13:44.405 DEBUG: Execution execute
10:13:44.624 INFO: Publish mode
10:13:44.749 INFO: Load global settings
10:13:44.936 DEBUG: GET 200 https://mysonar/sonar/api/settings/values.protobuf | time=172ms
10:13:44.999 INFO: Load global settings (done) | time=250ms
10:13:45.014 INFO: Server id: 217057F2-AWcxRObKorhGOjVakKPy
10:13:45.030 INFO: User cache: C:\Users\usr\.sonar\cache
10:13:45.295 INFO: Load plugins index
10:13:45.327 DEBUG: GET 200 https://mysonar/sonar/api/plugins/installed | time=32ms
10:13:45.358 INFO: Load plugins index (done) | time=63ms
10:13:45.358 DEBUG: Load plugins
10:13:45.374 INFO: Plugin [l10nfr] defines 'l10nen' as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2.
10:13:45.374 DEBUG: Load plugins (done) | time=16ms
10:13:45.452 DEBUG: Plugins:
10:13:45.452 DEBUG:   * FaaS profiles loader 3.2.0 (profilesloader)
10:13:45.452 DEBUG:   * Dependency-Check 1.1.6 (dependencycheck)
10:13:45.452 DEBUG:   * SonarCSS (cssfamily)
10:13:45.452 DEBUG:   * JaCoCo (jacoco)
10:13:45.452 DEBUG:   * SonarJS (javascript)
10:13:45.452 DEBUG:   * Findbugs 3.9.4 (findbugs)
10:13:45.452 DEBUG:   * SonarC# (csharp)
10:13:45.452 DEBUG:   * SonarJava (java)
10:13:45.452 DEBUG:   * SonarHTML (web)
10:13:45.452 DEBUG:   * Git (scmgit)
10:13:45.452 DEBUG:   * SonarFlex (flex)
10:13:45.452 DEBUG:   * SonarPHP (php)
10:13:45.452 DEBUG:   * French Pack 1.15.1 (l10nfr)
10:13:45.452 DEBUG:   * GitLab 3.0.2 (gitlab)
10:13:45.452 DEBUG:   * SonarTS (typescript)
10:13:45.858 INFO: Process project properties
10:13:45.858 DEBUG: Process project properties (done) | time=0ms
10:13:45.452 DEBUG:   * SonarFlex (flex)
10:13:46.092 DEBUG:   * Flex => "flex"
10:13:47.789 DEBUG: Declared extensions of language Flex were converted to sonar.lang.patterns.flex : **/*.as
10:13:49.383 DEBUG: 'Flex' skipped because there is no related file in current project
10:13:49.383 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
10:13:49.399 DEBUG: 'Flex' skipped because there is no related file in current project
10:13:49.399 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project

Even with a fake path like: sonar.flex.cobertura.reportPaths=fake/cobertura-coverage.xml I don’t get any hit:

10:33:53.259 DEBUG: ‘Flex Cobertura’ skipped because there is no related file in current project
10:33:53.259 DEBUG: ‘Flex Cobertura’ skipped because there is no related file in current project

I’ll try with an Oracle JDK and not an AdoptOpenJDK one

Do you have flex files in your project? By default, the flex language is associated to files which name ends with “.as”.

Hi, no I don’t, I just have typescript (ts) files, and a cobertura coverage xml file.
I’ll give it a shot with a dummy .as file

So yes, it was the issue, one has to have at least 1 .as file to trigger the cobertura report analysis! Thanks Pierre-Yves for your insight

I’ll now have to deal with paths (antislash / slash) within the cobertura report file, but that’s OK


Please next time be more explicit that you are analyzing TS code (adding typescript tag will help to avoid confusion). Using Flex property to import coverage for TS is clearly not a way to go (only coverage on Flex files will be saved).

So I can suggest you 3 ways to go:

  • generate LCOV coverage report for your TS code and import it with sonar.typescript.lcov.reportPaths or sonar.javascript.lcov.reportPaths (since SonarTS 2.0/SonarJS 6.0).
  • convert your cobertura report into generic sonarqube coverage format (check docs here)
  • try to find community plugin which import cobertura on any language

P.S. Please consider updating SQ you are using, you are using old LTS, the new one is 7.9. Otherwise we might not being able to help you as the version you are using is not maintained

1 Like

@Lena Hi, and you are totally right, I should have set this tag.

Indeed, I also came to the conclusion that the sonar.javascript.lcov.reportPaths was the way to go, and that for typescript, the flex plugin wasn’t necessary at all.

Thanks for this solution!