danielpalme / ReportGenerator

ReportGenerator converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
https://reportgenerator.io
Apache License 2.0
2.58k stars 281 forks source link

Unable to get the "group" element name when parsing the JaCoCo file #572

Closed Oliverfk closed 1 year ago

Oliverfk commented 1 year ago

Describe the bug I am using ReportGenerator Nuget version 5.1.9 in .Net 6.0. Here's how I use it to parse the JaCoCo reports:

  var filter = new DefaultFilter(new string[] { });
  CoverageReportParser parser = new CoverageReportParser(
      numberOfReportsParsedInParallel: 1,
      numberOfReportsMergedInParallel: 1,
      sourceDirectories: Array.Empty<string>(),
      assemblyFilter: filter,
      fileFilter: filter,
      classFilter: filter);

  var parserResult = parser.ParseFiles(JaCoCoFiles);

JaCoCo report has an element property called "group". The hierarchy of the elements starts with "group" -> "package" -> "class", etc. However, I cannot find the "group" information in the parserResult. The parserResult.Assemblies property only reflects the information under "package" element, yet I would also like to see the "group" element information.

To Reproduce I am attaching the JaCoCo file jacoco.txt (github does not allow me to upload .xml format, attaching the .txt instead). In my example, the JaCoCo has 10 <group name="">...<group> element blocks, yet the parserResult does not contain any "group" element information. See the screenshots: image image

I wonder if it is possible to have the group elements included in the Assemblies property, or make a new property called Groups for JaCoCo?

It's more like a bug then a feature request to me, so I created a bug report. Thank you.

danielpalme commented 1 year ago

ReportGenerator support a lot of different input formats. The different parsers create a common format to abstract away the differences between the different input formats. This is intentionally to be able:

That also means that not every detail is available in the intermediate format. This format is good enough to generate the reports. I understand that it may not fit your needs, but I won't introduce another hierarchy element here.

Oliverfk commented 1 year ago

Thanks for the answer. Fair enough.