-
Notifications
You must be signed in to change notification settings - Fork 664
Description
Summary
I use GitVersion through its MSBuild task. Yesterday by running "code coverage" from Visual Studio, I noticed, the generated GitVersionInformation class was considered as not covered code. Well, it's generated code and therefore It'd make sense for it not be part of the coverage statistics:
Detailed Description
Visual Studio (Enterprise) coverage facility uses compiled assemblies to compute code covered by unit tests statistics. Hence, even though GitVersionInformation wasn't written by the user, it appears in coverage results. I suspect it would be the same for other .NET coverage tools. This kind of code twists the coverage results (if only by a very tiny bit). It would be more correct to exclude it from coverage analysis.
Context
Honestly, this is not a must-have. I can live with a little discrepancy in my coverage resutls. However, I suppose changing this would be desirable for accuracy and correctness purpose.
Possible Implementation
The change should be rather straightforward (and I'm about to submit a PR for this): one only needs to add the ExcludeFromCoverage attribute on top of the generated code.
