-
Notifications
You must be signed in to change notification settings - Fork 769
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
Use consistent pattern for namespace of extension methods #1576
Use consistent pattern for namespace of extension methods #1576
Conversation
…they are extending
Codecov Report
@@ Coverage Diff @@
## master #1576 +/- ##
=======================================
Coverage 80.73% 80.73%
=======================================
Files 242 242
Lines 6544 6544
=======================================
Hits 5283 5283
Misses 1261 1261
|
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.
This looks good to me. We want to add this to changelog before merge.
src/OpenTelemetry.Exporter.Console/.publicApi/net452/PublicAPI.Unshipped.txt
Show resolved
Hide resolved
@reyang @CodeBlanch please share your thoughts as well. |
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.
LGTM.
…anwest/opentelemetry-dotnet into alanwest/consistent-extension-methods
I definitely agree with the approach that (in most cases) extensions should live in the namespace of whatever is being extended. Thanks @alanwest! |
This is an alternative to #1541.
I'm beginning to lean more towards leaving things alone for the most part. That is, I think the general rule of thumb that has been followed is to place extension methods in the same namespace as the type that they are extending. This is what Microsoft has followed with many of their libraries (e.g., Microsoft.Extensions.Configuration, Microsoft.Extensions.Logging, etc.).
However, there are a few places that do not follow this rule. I believe some of them are intentional exceptions to the rule, but some of them may have been unintentional.
I this PR, I've tracked down all of the public extension methods that are not contained in the same namespace as the type they are extending and changed them to be in the same namespace. There were two notable exceptions that I think are sensible exceptions to this general rule - I added a comment explaining why - please confirm the accuracy of my comments.
Questions: