Ruby on Rails + SimpleCov - File not found in the system (8.5.1 developer edition)

This is a repost of Ruby on Rails + SimpleCov - File not found in the system

My sonarqube is 8.5.1 developer edition.

I run the analysis via Jenkins (Jenkins 2.249.3, SonarQube Scanner for Jenkins 2.12, SonarScanner Both jenkins and sonar server have Java installed via rpm in a Centos 8.2.2004

Ruby is 2.6.3, Simplecov 0.16.1

The final report in Sonarqube reports 0% coverage and the console output of the jenkins job includes no obvious errors but does spit out many warnings about missing files.

INFO: 394/394 source files have been analyzed
INFO: Sensor Ruby Sensor [ruby] (done) | time=15766ms
INFO: Sensor Import of RuboCop issues [ruby]
INFO: Importing /some_path/rubocop.json
INFO: Sensor Import of RuboCop issues [ruby] (done) | time=7ms
INFO: Sensor SimpleCov Sensor for Ruby coverage [ruby]
WARN: File '/some_path/app/models/dashboardr/nil_tile_node.rb' is present in coverage report but cannot be found in filesystem

I verified the files are present and are world readable on the jenkins node that is executing the job.

Just to rule out the possibility that the files needed to be on the sonarqube server instead of the jenkins node, I manually copied the files to the same location (and verified permissions) on the sonarqube server.

For anyone searching, my issue was an edge case having to do with the directory structure.

On the O/S, the source files were in directory


but there was a symlink for convenience:

/Y -> /X/Y

the analysis job was running in directory /Y/Z but the coverage file was writing the paths as /X/Y/Z/file1.rb

By running the analysis job in directory /X/Y/Z, the issue went away.

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