Simplecov .resultset.json format changed with 0.18.0

Simplecov 0.18.0 has changed the output that it uses to store its results and the SimplecovSensor class bombs out trying to parse it.

Before, the structure was essentially

{
  "Unit Tests": {
    "coverage": {
      "/Users/jay/Setup/ruby/my-extensions/ffi-geos-git/lib/ffi-geos.rb": [
        // array of line data
      ]
    }
}

This has changed to allow for both line and branch data, so a new key has been inserted – the array of line data has been replaced with an additional layer that will be either a “lines” or “branches” key depending on the options passed to Simplecov.

Versions used:

  • SonarQube Scanner 4.2.0.1873
  • Java 11.0.3 AdoptOpenJDK (64-bit)
  • Linux 5.3.0-29-generic amd64
  • Ruby 2.6.5p114
  • Rails 6.0.2.1
  • Simplecov 0.18.1 (2020-01-31)

Error observed
Simplecov team was changed the structure of results.
.resultset.json on 0.17.1 version

{ "RSpec": { "coverage": { "/home/user/RubymineProjects/MyProject/app/api_wrappers/base_api.rb": { "lines": [ null, ...

.resultset.json on 0.18.1 version

{ "RSpec": { "coverage": { "/home/user/RubymineProjects/MyProject/app/api_wrappers/base_api.rb": [ null, ...

So now they using array inside a file, inseted of using json format and lines key
Steps to reproduce

  • Install last version of simplecov, e.g. 0.18.1
  • Run rspec test and check code coverage by runing coverage/index.html file
  • Run sonar-scanner
  • Results 0.0% coverage

@J_Smith, @likeuwill,

thank you for reporting this problem, I created ticket to track it https://jira.sonarsource.com/browse/SONARSLANG-477

@likeuwill, if I am not mistaken, the change is actually the opposite, they changed from using simple array, to using object with lines key

@saberduck yes, you right. Thank you, for your fast response.