Codecoverage with Generic test coverage report format

Hi,
Providing the sonar.externalIssuesReportPaths I’m able to include an LUA code to a project analysis. The report came from luacheck formated by python script output. This is - as I’m assuming - the right way to add some external analysis results to SQ. Why can’t I do the same with coverage?
There is generic test coverage report format and I’ve prepared a coverage report in required format but scan analysis tells me:

sonar-scanner \
  -Dsonar.projectKey=HC:123\
  -Dsonar.sources=. \
  -Dsonar.host.url=https://URL/ \
  -Dsonar.exclusions='**/*.java' \
  -Dsonar.token=sqa_xxx \
  -Dsonar.externalIssuesReportPaths=sonarqube_issues-$(git rev-parse --abbrev-ref HEAD).json \
  -Dsonar.sensor.cache.enable=false \
  -Dsonar.filesize.limit=30 \
  -Dsonar.branch.name=$(git rev-parse --abbrev-ref HEAD) \
  -Dsonar.coverageReportPaths=coverage.xml \
  -Dsonar.verbose=true
...
14:34:13.374 INFO  Parsing /Users/tks/tmp/repositories/ALL/HC/hc-123/coverage.xml
14:34:13.382 DEBUG Skipping file 'tests/lua-unit/preamble.lua' in the generic coverage report because it doesn't have a known language
14:34:13.385 INFO  Imported coverage data for 0 files
14:34:13.385 INFO  Coverage data ignored for 1 unknown files, including:
tests/lua-unit/preamble.lua
14:34:13.385 INFO  Sensor Generic Coverage Report (done) | time=11ms

Is it not a case in other than community edition deployment or is it a case on all license types?

Hey there.

In general, a file needs to be parsable by SonarQube in order to import coverage. Issues are a bit easier, and were a higher priority when we implemented support for importing issues on unknown files.

There’s a very old ticket to change this for coverage, although I don’t have much hope that we’ll see it implemented. SONAR-12015. I’ll still link this thread to that ticket to track traction!

There are some very old community-supported plugins to add LUA support to SonarQube (GitHub - SonarQubeCommunity/sonar-lua) which I’m sure no longer work in modern versions of SonarQube, but it might be a good starting point if you were interested in adding support for Lua.

Hey,
I’m aware about the outdated sonar-lua plugin. Having this up to date would solve my subject but … is it how it is. Maybe do you have some plans to support lua natively - do you? On the latest webinar I haven’t hear that but maybe there is some ticket I could vote for :slight_smile:
From my perspective it would be logical to have an ability to import external coverage report exactly as it’s possible to import external analysis report especially you provides a generic test format. And the report seems to contain required content:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<coverage version="1">
  <file path="tests/lua-unit/preamble.lua">
    <lineToCover lineNumber="1" covered="false"/>
    <lineToCover lineNumber="2" covered="false"/>
    ...
    <lineToCover lineNumber="78" covered="true"/>
    <lineToCover lineNumber="79" covered="true"/>
  </file>
</coverage

Lua support is not in our roadmap, and there’s a lot of regularly requested languages that are in line first, but I’ll make sure that somebody makes a note!