Comments (12)
I will have a look within the days.
from reportgenerator.
I appreciate the dialog here and the work you've both done on your respective tools =)
from reportgenerator.
This behavior is "as designed". Nested classes are processed as a part of the parent file.
Otherwise the HTML reports could become bloated with nested and compiler generated classes.
I understand that this makes sense for the user interface, but wouldn't it be more appropriate if the model would retain the original structure and add these nested classes to the parent file? E.g. in JaCoCo reports those nested classes are also shown as direct descendants of the associated file, but they are not removed (i.e. the class in class hierarchy is flattened). Can't you ignore these classes in the HTML reports only?
I added a fix to ignore and skip those method nodes on my side (see jenkinsci/coverage-model#39) but it would be more appropriate if the generated model would retain this information.
from reportgenerator.
No worries, I released a new version of the Jenkins coverage plugin that is more resilient about "errors" during parsing.
from reportgenerator.
I decided to not implement the required changes (at least not at the moment).
Reasons:
- It would require quite a lot of work, as I would have to change all the different parsers.
- It would be a breaking change for many users. One option could be, that the new behavior is only enabled with an additional command line option, but then only very few users will notice the new option.
- For many .NET based projects merging coverage report is no longer necessary. If you use Microsoft.CodeCoverage and execute the tests at the solution level, you'll get a single coverage file.
See also: https://devblogs.microsoft.com/dotnet/whats-new-in-our-code-coverage-tooling/ (section "Auto-Merge for solutions")
from reportgenerator.
I just released version 5.2.4. This version includes a new setting (settings:rawMode=true
).
The setting disables that coverage data of nested or compiler generated classes is included in the parent class.
This is useful to merge several Cobertura files into a single file, since the original class structure remains untouched.
Limitations:
- Raw mode is currently only supported for Cobertura files.
- If you want HTML report and Cobertura output, you should execute ReportGenerator twice:
- Cobertura:
settings:rawMode=true
- HTML:
settings:rawMode=false
- Cobertura:
You need a PRO license to use the new feature.
Documentation of the new feature:
https://reportgenerator.io/features#rawmode
https://reportgenerator.io/pro
from reportgenerator.
Possibly related, this happens with nested classes as well.
public static class Outer
{
public static class InnerFirst
{
}
public static class InnerSecond
{
}
}
Will create two entries under "Outer" with the name of ".cctr" and an empty signature
from reportgenerator.
I just had a look at the two problems:
- Duplicate Index method
This is the relevant information from coverage.cobertura.txt
<class name="CoverletRepro.TestController" filename="TestController.cs" line-rate="1" branch-rate="1" complexity="1">
<methods>
<method name="Index" signature="()" line-rate="1" branch-rate="1" complexity="1">
...
<class name="CoverletRepro.TestController/<Index>d__1" filename="TestController.cs" line-rate="1" branch-rate="1" complexity="1">
<methods>
<method name="MoveNext" signature="()" line-rate="1" branch-rate="1" complexity="1">
Both signature
attributes show an empty method signature.
This results in the described output with two methods that look the same.
ReportGenerator does not parse the corresponding source code, it relies on the coverage file.
In this case the result is not perfect, but the input is neither.
- Nested classes
This behavior is "as designed". Nested classes are processed as a part of the parent file.
Otherwise the HTML reports could become bloated with nested and compiler generated classes.
Methods and/or constructors of nested classes will be listed in the context of the parent class and therefore several entries with the same name and signature can appear. They are not referring to the same code lines though, you can see different <line>
elements within those method
elements.
from reportgenerator.
This originally came up because the code coverage plugin I use in Jenkins updated and now errors if there are duplicated entries (See jenkinsci/code-coverage-api-plugin#785).
Your point about the nested classes seems to say this behavior of rejecting duplicate method names is incorrect.
from reportgenerator.
Your point about the nested classes seems to say this behavior of rejecting duplicate method names is incorrect.
"Incorrect" is a bit too hard. I would say, it would be good not to rely on unique names.
There are situations where it can happen (obviously).
from reportgenerator.
@uhafner
You are right, for the Cobertura report it would make sense to retain the original structure.
I will have a look, if I can change the structure. But it will take some time, since this will require some rework and I'm pretty busy at the moment :-)
from reportgenerator.
Ms code coverage isn't a solution because of
from reportgenerator.
Related Issues (20)
- minimumCoverageThresholds:lineCoverage not working HOT 12
- Issue with -reporttypes field HOT 1
- Wiki Edit HOT 1
- Unable to convert opencoverxml file into corbertura.xml file using ReportGenerator in Azure Devops Pipeline HOT 3
- Release notice confuses me. HOT 1
- Why is the reportgenerator command installed using the dotent not working? HOT 2
- Report generated is always at version 5.1.14.0 on AzureDevops HOT 1
- Allow to specify the root path HOT 1
- Question: Is the format created by the CTC++ tool supported as input for report generator? HOT 2
- MS Coverage output isn't cleaning compiler generated methods/types HOT 8
- Ability to exclude classes from Risk Hotspots HOT 6
- Error while converting jacoco report to cobertura HOT 12
- Suggestion for new report type: MarkdownTableShortSummary HOT 2
- Sonarqube format clashes with DeterministicSourcePaths=true HOT 5
- Azure DevOps task option publishCodeCoverageResults doesn't work with relative targetdir path HOT 2
- Azure pipeline failure due to dependency on NodeJS version 6 HOT 3
- Docs/readmes: add info about `minimumCoverageThresholds` HOT 2
- ReportGenerator 5.3.1 fails on self hosted azure devops agent running on Amazon Linux 2 arm64 instance (t4g) HOT 2
- Question about lcov conversion HOT 4
- Strange source file references in a HTML report from dotnet-coverage on Linux
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reportgenerator.