Error with code coverage - Simplecov

SonarQube Scanner|
Java 1.8.0_232 AdoptOpenJDK (64-bit)|
Linux 4.14.186-146.268.amzn2.x86_64 amd64|
SonarQube server 8.4.1


I am having a problem with my ruby on rails project in bamboo. My RSpec and coverage reports are run in a Docker container in the following path:


so the resulting simplecov .resultset.json has the files all listed in that path.

Sonar is not ran in Docker so the path to the files is different.

I assumed Sonar was complaining as it could not find the files in this path, so I used a script to manipulate the .resultset.json file and replace all the “/usr/src/app” with the correct local directory that Sonar is running in.

But I am still getting the error on every file not being found, even though the files are correct.


WARN: File 'app/services/detail_service.rb' is present in coverage report but cannot be found in filesystem.

What way does Sonar expect the paths to be in the coverage file? Absolute paths or relative?

I was finally able to resolve this by replacing the path in the SimpleCov results file, with the Bamboo working directory path.

I was able to use a Bamboo environment variable for the replacement. Now Sonar can see the files in the filesystem, it must need an absolute path in Bamboo/

original path was: “/usr/src/app”
new path was: “/home/bamboo/bamboo-agent-home/xml-data/build-dir/SDBG4987-DSR”

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