Skip to content
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

Changed source paths/filenames in 8.8.173 in combination with reportgenerator #229

Closed
SteveGilham opened this issue Aug 15, 2024 Discussed in #228 · 5 comments
Closed

Comments

@SteveGilham
Copy link
Owner

Discussed in #228

Originally posted by kimpenhaus August 15, 2024
Good morning @SteveGilham,

sorry bothering you again :) We've noticed a change in the generated cobertura files from 8.8.74 to 8.8.173 in the way the source elements and the filenames are generated.

I don't see an issue in this per se but with our setup the changes breaks the coverage analysis. we have a multi-projekt/assembly setup in azure that generated the code coverage with altcover in cobertura format and uses reportgenerator to "transform" this into single file cobertura and sonarqube generic format.

When updating to the latest version we realised that the reportgenerator threw lots of file not found warnings. drilling this down leeds us to the changes done by the new altcover verion. I will try to explain further:

In 8.8.74 it seems thet all filenames were absolute and the sources seem to contain all directories

assembly 1 (sample):

grafik grafik

assembly 2 (sample):

grafik grafik

With the new 8.8.173 version same sources this seems to have changed in the way that sources contains the lowest common denominator (hopefully you understand what I mean with that :)) dircotryname and the filenames are relative to that:

assembly 1 (sample):

grafik grafik

assembly 2 (sample):

grafik grafik

the change itself looks conclusive and recduces the size of the generated files - so I don't see an issue here itself.

But when heading to reportgenerator we have the problem that the reportgenerator won't find these files.

What we tried is to set the sourcedirs parameter to /agent/_work/1/s/src but that will only fix those that matches with that directory in the sources. In the given samples /StringExtensions.cs would not be found as the filename is not relative to /agent/_work/1/s/src.

grafik

as the assemblies (and maybe future assemblies) might vary in what sources will contain we have no idea what to set in the sourcedirs to cover this in general.

So our question is: Is there a way to have a root source directory which tells altcover to generate all sources and filename relative to that? So that we cann have /agent/_work/1/s/src in altcover and in reportgenerator?

Thanks for any suggestion 🙏🏼

@SteveGilham
Copy link
Owner Author

This change was intended as a resolution to issue #197, and also to bring the output into conformance with the original cobertura format, based as it is on the Java behaviour of keeping file path and full class name in step with one another.

It should be extracting longest common leading paths - in this case it should be extracting /agent/_work/1/s/src, or at worst /agent directly. As it clearly isn't doing that, there's a bug somewhere in the process.

@SteveGilham
Copy link
Owner Author

The leading common path extraction is coverage-report wide; with multiple independent reports being consolidated, each would have its own local root path.

@SteveGilham
Copy link
Owner Author

SteveGilham commented Aug 16, 2024

Looks like there's an easy enough resolution - allow user specification one or more package roots like "C:\this, D:\that\or\The\other" (or "/this", "/that/or/the/other") and just add those to the mix.

@SteveGilham
Copy link
Owner Author

Should be resolved in v8.9.3

@kimpenhaus
Copy link

@SteveGilham - thanks again for fixing it such quickly - I just gave it a shot and that looks very good:

grafik

the rport was generated with no error:

grafik

Thanks Steve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants