-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to use relative paths in OpenCover report #1315
Comments
I am having a similar problem, but only on one project. My other projects have the base path in I can't find any difference in setup/config. It's driving me mad!!! |
Here's an old issue we can hopefully refer back to, to see where this is handled and maybe get some ideas what may be going wrong: https://github.com/coverlet-coverage/coverlet/pull/661/files I'm on my mobile at the moment so can't check. |
💥 sussed it... reading through the code I noticed:
And my problematic project has only 2 classes, one of which is tagged with I removed the data annotation and voila- the cobertura report has a valid Should we consider this a bug or find a way to tackle it? 🤔 |
Not sure what you mean? |
This was just an explanation of my problem/solution. I'm sure yours wont be exactly the same but hopefully you can use some of the above information to help you diagnose/troubleshoot. Looking at your example, it shows at least 3 files, so I don't think your issue relates to only having one class being analysed. Are you able to share a link to the GitLab project? (I suspect not- but just in case). Can you share your command-line? And perhaps more/all of the generated cobertura report? |
Sadly no.
Command line is in the issue, I can see about entire report, will have to anonymize it a bit. |
Ah yes, forgive me. So this is actually I can't see anything in https://github.com/coverlet-coverage/coverlet/blob/master/src/coverlet.core/Reporters/OpenCoverReporter.cs to attempt to rationalize, so I think this would need adding (could copy the code from Do you know if you could use I don't really know anything about Sonarqube. Do you get test coverage in the GitLab UI? That's what we get by generating the |
Sadly Sonar doesn't have support for Cobertura for C# code coverage: So I would have to just implement the normalization for OpenCover to fix it? |
@RedlineTriad I don't know all the features for Sonarqube, do you know if they support deterministic report https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/DeterministicBuild.md#deterministic-report? At the moment we support it only for cobertura report, but we're planning to support it also for others. This is the tracking PR #1075 |
@RedlineTriad Maybe you could open an issue on SonarQube side too because it seems (from the link you pasted) that they do support covertura for both Flex and Python so I guess it should not be too much of a trouble to add it for C#. |
Thanks @Evangelink @RedlineTriad , I've mentioned this to our PM (about adding support for the cobertura format for the Sonar C# offering). |
Same problem here. My workaround (for linux):
Runner2:
Explanation: |
This issue is stale because it has been open for 3 months with no activity. |
This issue was closed because it has been inactive for 9 months since being marked as stale. |
I am running coverlet in a self-hosted GitLab instance to collect code coverage for Sonarqube.
Problem is, we have Windows runners and the test job and the sonar job can run in different absolute paths.
This causes Sonarqube to be unable to calculate code coverage because the absolute paths from the first job point nowhere.
This is the command I am using:
This is what the report looks like (with anonymized paths):
How can I make coverlet generate the opencover with paths relative to execution/project instead of absolute ones?
I looked at multiple issues similar to this one but didn't see any resolution on what to do.
I also read the docs, but the only options I saw
--use-source-link
or somehow using deterministic builds.With source link enabled it still generated absolute paths and I haven't tried deterministic build because it didn't seem straightforward.
The text was updated successfully, but these errors were encountered: