My sonar analysis is failing due to .rb files being interpreted as Ruby when the extension means something else in my project:
19:41:24.058 INFO: Sensor Ruby Sensor [ruby]
19:41:24.071 INFO: 143 source files to be analyzed
##[error]2022-04-29T19:41:24.846Z [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
ss ‘–add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED’ to enable.
##[error]19:41:26.374 ERROR: Unable to parse file: file:///__w/1/s/TARDIS/test/bede/rbfind/minimum-length,1/output,expected.rb. Parse error at position 1:1
19:41:26.374 ERROR: Unable to parse file: file:///__w/1/s/TARDIS/test/bede/rbfind/minimum-length,1/output,expected.rb. Parse error at position 1:1
##[error]19:41:26.376 ERROR: Cannot parse ‘TARDIS/test/bede/rbfind/minimum-length,1/output,expected.rb’: (SyntaxError) unexpected token tCOLON
19:41:26.376 ERROR: Cannot parse ‘TARDIS/test/bede/rbfind/minimum-length,1/output,expected.rb’: (SyntaxError) unexpected token tCOLON
I have tried:
In a sonar-project.properties file and also in the additional properties for the Azure task but it does not seem to work.
What might I be doing wrong and what else can I try?
I spoke too soon it does not work on Azure DevOps using:
or the properties file which works from the command line.
The log contains:
2022-04-29T22:07:26.6539715Z 22:07:26.652 INFO: Excluded sources: **/build-wrapper-dump.json, *.rb
2022-04-29T22:07:35.2098103Z 22:07:35.209 DEBUG: ‘test/tools/rbplot/plot,2/sim.rb’ indexed with language ‘ruby’
2022-04-29T22:08:03.6883604Z ##[error]22:08:03.687 ERROR: Unable to parse file: file:///__w/1/s/TARDIS/test/tools/rbplot/plot,2/sim.rb. Parse error at position 1:4
22:08:03.687 ERROR: Cannot parse ‘test/tools/rbplot/plot,2/sim.rb’: (SyntaxError) unexpected token tCOLON
However it looks like this error is cosmetic and not fatal.
2022-04-29T22:08:04.8686622Z 22:08:04.865 INFO: 143/143 source files have been analyzed
2022-04-29T22:08:04.8703221Z 22:08:04.867 INFO: Sensor Ruby Sensor [ruby] (done) | time=3662ms
2022-04-29T22:08:04.8704019Z 22:08:04.867 INFO: Sensor SimpleCov Sensor for Ruby coverage [ruby]
Still removing noise by disabling unwanted sensors would help a lot,
My actual problem is:
2022-04-29T22:08:04.9485974Z 22:08:04.948 INFO: Parsing /__w/1/s/coverageSonar.xml
2022-04-29T22:08:04.9682422Z 22:08:04.967 INFO: ------------------------------------------------------------------------
2022-04-29T22:08:04.9683111Z 22:08:04.967 INFO: EXECUTION FAILURE
2022-04-29T22:08:05.1384955Z ##[error]22:08:05.135 ERROR: Error during SonarScanner execution
22:08:05.135 ERROR: Error during parsing of the generic coverage report ‘/__w/1/s//coverageSonar.xml’. Look at SonarQube documentation to know the expected XML format.
22:08:05.135 ERROR: Caused by: Unexpected EOF in prolog
In the documentation on analysis scope, you’ll find the proper syntax for excluding files. You are probably interested in an exclusion more like
With regard to your actual error:
It looks like generic test data is being imported using the
sonar.coverageReportPaths analysis parameter… but the report doesn’t match the expected format. Do you know how /__w/1/s//coverageSonar.xml is generated – what tool is used?
Yes **/*.rb seems to be the answer.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.