The file has no scoverage information associated with it. #56
Comments
I thought so too, but running it on Linux resulted in the same issue. I am now playing around with the code a bit and it seems that the moduleCoverage.filesCoverage map is empty. Specifically, this piece of code in ScoverageReportParser seems to be at fault:
Given the following parameters: This tries to resolve the path cwd/src/main/scala/src/main/scala/com/intel/daas/sdk/application/ApplicationContext.scala Which is wrong, since the filename already contains the prefix :) |
Uhm... yes, you're right. Could you try the following piece of code? filename <- sourcePrefixes.collectFirst {
case prefix if cwd.relativize(cwd.resolve(Paths.get(prefix))).relativize(Paths.get(scoverageFilename)).toFile.exists =>
cwd.relativize(cwd.resolve(Paths.get(prefix))).resolve(scoverageFilename)
} |
That doesn't compile for me.. I assume you're using java.nio.file.Paths? in that case the get method accepts either a String or a URI, while prefix is Path. I tried prefix.toURI and that didn't work.. |
Edit filename <- sourcePrefixes.collectFirst {
case prefix if cwd.relativize(cwd.resolve(prefix)).relativize(Paths.get(scoverageFilename)).toFile.exists =>
cwd.relativize(cwd.resolve(prefix)).resolve(scoverageFilename)
} I'm sorry for the confusion. Could you try it again? PS: This is just for making a quick test/fix. I will make PR for fixing this in a couple of days. |
Unfortunately that didn't work. I think the underlying issue is that the filename in the scoverage.xml already contains the prefix "src/main/scala", making the prefix actually redundant. No changes would be needed if there was any way to remove this prefix from the filename in the generated scoverage.xml report, but there doesn't seem to be any such option in the gradle plugin. |
Yes, you're right. We're having a big problem here: Uhm... @mwz Any thoughts? @dmarkhas, sorry again for not being of much help, when I have time I will work in this. |
I really appreciate your help :-) Perhaps checking if the scoverageFilename begins with the prefix and then stripping it out would work? |
Hi @dmarkhas, thanks for reporting the issue. It sounds like your suggestion to strip out the prefix from the filename should work, so it's worth giving it a try. It's a shame that there are so many inconsistencies between different distributions of sonar scanners and scoverage plugins... this certainly doesn't make our life easier and it starts slowly to feel like we're doing cross-browser development 😆 |
Problem occurs for multi modules projects (works properly for projects without modules) sonar-project.properties: output: |
Hi @freshka, thanks for letting us know that you're having issues. Would you mind sharing with us some more details about your setup like e.g. which build tool you're using, how your multi-module project is structured, your full Would you also be able to confirm that you've set the |
Hi @mwz Project structure example:
Analize execute by Jenkins (SonarQube Scanner v. 3.0.3.778) and scoverage reports not aggregated. Sonar-scala plugin cannot find files but properly read report as i said above: sonar-project.properties: |
Hello @freshka, If the reports are not aggregated, that means there is one report per module, is that correct? Also, could you please provide us one of the scoverage files? (If they contain sensitive information that you wouldn't like to share, we only need the |
Hi @BalmungSan
filename is relative to module path, not to project root |
The issue that @freshka encounter is exactly the same as mine. I'm waiting for the fix of this |
@mwz I appreciate the effort you've put into it. I'll wait for the new release |
@sinwe, @freshka, just to let you know that 6.4.0 was released a couple of days ago and it should fix your Gradle issues with multi-module projects. You can also find an example of a multi-module project built with Gradle here and here is the result of SonarQube analysis with coverage reported for each module. Thanks again for reporting the issue and please feel free to let us know if you come across anything else. |
We're using version 6.2.0 of the plugin, but when running the sonarqube task from Gradle it seems that it somehow fails to parse the scoverage.xml report, even though it finds it and loads it successfully.
These are the errors I am seeing:
[scoverage] Initializing the scoverage sensor.
[scoverage] Successfully loaded the scoverage report file: 'C:\Users\dmarkhas\IdeaProjects\sdk-base\build\reports\scoverage\scoverage.xml'.
[scoverage] The file: 'src/main/scala/com/intel/daas/sdk/Launcher.scala' has no scoverage information associated with it.
[scoverage] The file: 'src/main/scala/com/intel/daas/sdk/application/AbstractSparkApplication.scala' has no scoverage information associated with it.
[scoverage] The file: 'src/main/scala/com/intel/daas/sdk/application/ApplicationContext.scala' has no scoverage information associated with it.
I saw #51 but in this case the filenames match exactly the filenames in the xml report so I'm not sure what's wrong. I've attached the scoverage report (had to rename from .xml to .txt for GitHub) - anything obvious I am missing perhaps?
scoverage.txt
The text was updated successfully, but these errors were encountered: