-
Notifications
You must be signed in to change notification settings - Fork 656
Add ExcludeFromCodeCoverage attribute on top of generated GitVersionI… #2306
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
Conversation
So here is the problem with the VB.NET Generated code: I suggest to enclose the generated code into this so that it behaves like the C# code: Namespace Global
... existing class template
End Namespace This change is not part of this PR because I wonder if I should propose another PR for this |
Concerning F#, it is a bit more tricky. Modules seem to generate plenty of stuff that is not inheriting the For now, I managed to achieve 100% coverage by changing the F# module into a static class. Something like that: namespace global
[<AbstractClass; Sealed>]
[<global.System.Runtime.CompilerServices.CompilerGenerated>]
[<global.System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage>]
type GitVersionInformation() =
static member Major = "1"
static member Minor = "2"
static member Patch = "3"
... However, this being quite a big change, I didn't pushed it yet. Waiting for approval here. |
…nformation classes Fix: missing global namespace before attributes
1d51f5e
to
3efb2ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't even know the attribute existed, so this seems like an obvious, low-hanging fruit. Thanks!
You're welcome! And what about the 2 other issues I mention above? Could you have a look at them?Should I open dedicated issues? |
Yes, please open one PR per issue. I think both solutions look good, I'm just a bit unsure about the backwards compatibility of them, so let's discuss that in each provided PR. |
True, both issues may raise compatibility concerns. I'll do just that and open issues when I find some time! |
🎉 This issue has been resolved in version 5.3.6 🎉 Your GitReleaseManager bot 📦🚀 |
…nformation classes
Description
This decorates generated code with
ExcludeFromCodeCoverage
attribute so that it does not participate in code coverage statistics.Related Issue
#2305
Motivation and Context
This prevents generated code from being detected as 'not covered'. Generated code should not be part of code coverage statistics.
How Has This Been Tested?
In order to make sure adding this attribute resulted in 100% coverage, I crafted a simple solution with a VB.NET, a C# and a F# project + a unit test. This project is available here: https://github.com/odalet/GitVersionTests
I couldn't achieve 100% coverage on the F# lib and detected a potential issue on the VB project. I describe these below in subsequent comments because I don't really know what way to go with these and then am opening discussions.
Checklist: