I am using Coverlet + SourceLink to generate cobertura code coverage reports for my .NET Standard project. The XML files are generated fine. They have classes like the following:
<class name="Foo.Bar" filename="https://raw.githubusercontent.com/wsugarman/Example/123456789ABCDEF/src/Example.Project/Foo/Bar.cs" ...>
<!-- Code Coverage -->
</class>
However, when I go to generate my report with a command such as:
reportgenerator --reports:coverage.cobertura.xml -targetdir:reports -reporttypes:"Cobertura"
I see the below error:
File 'https:\\raw.githubusercontent.com\wsugarman\Example\123456789ABCDEF\src\Example.Project\Foo\Bar.cs' does not exist (any more).
It seems that all of the forward-slashes are converted to backslashes inappropriately, and the URL cannot be found! I took a look into the code to see what could be the problem, and I saw that in the CoberturaReportPreprocessor, the filename attributes have their slashes normalized to Path.DirectorySeparatorChar. This prevents CachingFileReader from detecting that the file is remote.
Am I perhaps missing something when using SourceLink? Otherwise, I'd be happy to try my hand at a fix.
Correct. The preprocessor should ignore files that start with "http://" or "https://".
If you like, you can create a PR.
New release 4.4.2 will fix this issue (should be available within a few minutes).
Oh! That鈥檚 great news! You beat me to it haha. I鈥檒l give the new version a shot.
Looks like it's all good. Thank you for fixing it so quickly!