sonar.ruby.coverage.reportPaths and wildcards for CI

Template for a good new topic, formatted with Markdown:

  • ALM used: Github
  • CI system used Circle CI with parallel test runs
  • Scanner command used when applicable (private details masked): sonarcloud/scan (Circle Orb)
  • Ruby

Attempting to set sonar.ruby.coverage.reportPaths=coverage/coverage*.json in sonar-project.properties doesn’t work which creates a workflow headache with SimpleCov.

We use parallel rspec test runs in our .circle/config.yml (using Circle parallelism), these persist results into the workspace at coverage/coverage-${CIRCLE_NODE_INDEX}.json. We run either 12 in parallel or 16 depending on the application. The exact tests in each run varies and is calculated by circle based on a split-by-timings approach.

In a final dependent job, we attach_workspace and run sonarcloud/scan which aims to upload these coverage files as defined in our sonar-project.properties, we could:

  • set this value to sonar.ruby.coverage.reportPaths=coverage-0.json coverage-1.json ...etc, but this creates a dependency between the CircleCI setting for how many parallel workers are defined for that run.
  • spin up a ruby process to merge the .result-set.json files into one big coverage.json file but that creates a heavier dependency on the docker image needed for the scan step as it now would require both nodejs and ruby which ultimately increases our build time.

In the end, this setting needs to support wildcards, or better, just allow specifying a directory and if that’s the case take all of the files within this directory.

Alternately the sonarcloud ORB could allow the job to define additional params for the scan via some environment variable that we could use circle/shell features to calculate, but currently it overwrites any params.

1 Like

Hi @sam-enough,

This is indeed a good suggestion. Here is the ticket: [SONARSLANG-587] - Jira
Thank you!

All the best,

Irina

1 Like