I am using Sonarqube I believe version 9.
I have a vue application and using an Azure pipeline to run jest tests.
I am trying to understand why statemennts like these are showing as uncovered as it affects the coverage percentage.
I am using Sonarqube I believe version 9.
I have a vue application and using an Azure pipeline to run jest tests.
I am trying to understand why statemennts like these are showing as uncovered as it affects the coverage percentage.
Hey there.
If you’re providing an lcov.info for a file, that file itself is saying whether or not that line can be covered by code.
If there’s no information being provided for a file, SonarQube has to “guess” (it runs this code to determine if the line is executable or not).
Is this falling into that second category? This can happen if, for example, there is no coverage being reported on that file at all.
Hi,
Can you check your page footer to get your SonarQube version? Can you also share your analysis log?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
This guide will help you find them.
Thx,
Ann
I also see that its looking at blank lines as uncovered
24.txt (330.6 KB)
Hi,
Unfortunately the file you uploaded comes up blank in my text editor.
Can you verify that your coverage report is freshly generated with each CI run?
And could you copy/paste your logs? Adding ```
on the line before and on the line after will code-format them.
Thx,
Ann
Hi,
Yes it is generated each time.
I have added the ```. Please let me know if you are able to see it now.
24.txt (328.1 KB)
Hi,
I meant to copy/paste the text into a post, but for whatever reason, the second upload worked.
When I look at this log, I see a lot of lines like this:
2024-02-21T13:55:02.1073790Z 13:55:02.075 DEBUG: Problem during processing LCOV report: can't save DA data for line 16 of coverage report file (java.lang.IllegalArgumentException: Line with number 42 doesn't belong to file BaseButton.vue).
2024-02-21T13:55:02.1195889Z 13:55:02.075 DEBUG: Problem during processing LCOV report: can't save DA data for line 17 of coverage report file (java.lang.IllegalArgumentException: Line with number 43 doesn't belong to file BaseButton.vue).
2024-02-21T13:55:02.1197353Z 13:55:02.075 DEBUG: Problem during processing LCOV report: can't save DA data for line 73 of coverage report file (java.lang.IllegalArgumentException: Line with number 98 doesn't belong to file BaseButtonGroup.vue).
2024-02-21T13:55:02.1198176Z 13:55:02.075 DEBUG: Problem during processing LCOV report: can't save DA data for line 74 of coverage report file (java.lang.IllegalArgumentException: Line with number 104 doesn't belong to file BaseButtonGroup.vue).
2024-02-21T13:55:02.1198912Z 13:55:02.075 DEBUG: Problem during processing LCOV report: can't save DA data for line 75 of coverage report file (java.lang.IllegalArgumentException: Line with number 105 doesn't belong to file BaseButtonGroup.vue).
It seems that your coverage report somehow doesn’t like up to your project data? That would explain the strange coverage results you see reflected in SonarQube. Because when a file is present in a coverage report, we go - line for line - by what the report says about the file.
I suspect you need to look into the report generation. Unfortunately, I don’t know anything about Jest tests, so I can’t give any more help than that.
Ann
Hi there,
Is there perhaps someone else who could assist?
I saw a few threads with people getting the same error. I could potentially share my config files with someone who may know what the solution is?
Thanks
Tejal
Hi Tejal,
Can you start by looking at your coverage report to see if what you see there actually matches up to the files in your project?
Ann