SonarQube coverage doesn't work for Ruby SimpleCov v0.21.2

I’m using latest sonarsource/sonar-scanner-cli Docker image.

I’m trying to display tests coverage in SonarQube’s dashboard.

I tried using coverage/coverage.json file produced by SimpleCov v0.21.2 JSONFormatter. I’m getting the following error:

INFO: Sensor SimpleCov Sensor for Ruby coverage [ruby]
ERROR: Cannot read coverage report file, expecting standard SimpleCov resultset JSON format: 'coverage/coverage.json'
java.lang.NullPointerException: null
	at org.sonarsource.ruby.plugin.SimpleCovSensor.mergeFileCoverages(SimpleCovSensor.java:119)
	at org.sonarsource.ruby.plugin.SimpleCovSensor.safeReadCoverageReport(SimpleCovSensor.java:83)
	at org.sonarsource.ruby.plugin.SimpleCovSensor.lambda$execute$0(SimpleCovSensor.java:72)
	at java.base/java.util.HashMap.forEach(Unknown Source)
	at org.sonarsource.ruby.plugin.SimpleCovSensor.execute(SimpleCovSensor.java:72)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)
	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)

INFO: Sensor SimpleCov Sensor for Ruby coverage [ruby] (done) | time=32ms

The coverage/coverage.json file looks like this:

{
  "meta": {
    "simplecov_version": "0.21.2"
  },
  "coverage": {
    "/app/app/api/api_app.rb": {
      "lines": [
        null,
        null,
        1,
        1,
        null,
        null,
        1,
        null,
        1,
        null,
        1,
        null,
        null,
        null,
        null,
        1,
        1,
        null,
        1,
        null,
        0,
        0,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null
      ]
    },

I’ve found a few topics and a ticket saying that SimpleCov >= v0.20 + JSONFormatter should work, but that’s not true for me. Am I missing something?

Hi there.

What version of SonarQube are you using?

Hi! The version is 8.6.0.39681 if I’m looking in the right place.

Any thoughts?

Hello, has this issue been resolved?

Hi @Colin_SonarSource do you have any insight into this issue?