-
Notifications
You must be signed in to change notification settings - Fork 0
Improve inheritance resolver for plaintext render #29
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
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.
Pull Request Overview
This PR improves the inheritance resolver logic used by the plaintext renderer and updates test coverage for various inheritance scenarios.
- Refactors methods in InheritanceResolver to remove the XML node parameter and streamline member lookup.
- Updates renderer options and PlainTextRenderer logic to use the new settings (Trim and RemoveNamespace).
- Revises and extends tests to cover multiple inheritance and interface scenarios.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tests/Render/BitzArt.XDoc.PlainText.Tests/PlainTextRendererEndToEndTests.cs | Adds end-to-end tests for plaintext rendering with updated inheritance handling |
tests/Render/BitzArt.XDoc.PlainText.Tests/InheritanceResolverTests.cs | Updates tests to align with changes in the inheritance resolver API and class hierarchies |
src/Render/BitzArt.XDoc.PlainText/XDocExtensions.cs | Adjusts renderer options usage to align with new settings |
src/Render/BitzArt.XDoc.PlainText/RendererOptions.cs | Renames and repurposes options to use Trim and RemoveNamespace |
src/Render/BitzArt.XDoc.PlainText/PlainTextRenderer.cs | Modifies inheritance resolution and rendering behavior, including a recursive call that requires review |
src/Render/BitzArt.XDoc.PlainText/InheritanceResolver.cs | Refactors member lookup and simplifies interface handling by inlining GetImmediateInterfaces logic |
src/Render/BitzArt.XDoc.PlainText/Extensions/TypeExtensions.cs | Removes redundant extension as immediate interface extraction is now handled within InheritanceResolver |
@@ -165,6 +165,12 @@ private string RenderDirectInheritance(XmlElement element, MemberInfo? target) | |||
|
|||
var documentationElement = _xdoc.Get(targetMember); | |||
|
|||
if (documentationElement == null) |
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.
The recursive call to RenderDirectInheritance using the same targetMember when documentationElement is null may lead to infinite recursion. Consider returning an empty string or handling the null case differently to prevent a potential stack overflow.
Copilot uses AI. Check for mistakes.
[.. methodInfo.GetParameters().Select(p => p.ParameterType)]), | ||
|
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.
The use of the spread-like operator '[.. ...]' in the GetMethod call is non-standard in C#. Consider replacing it with methodInfo.GetParameters().Select(p => p.ParameterType).ToArray() to ensure proper compilation and overload resolution.
[.. methodInfo.GetParameters().Select(p => p.ParameterType)]), | |
methodInfo.GetParameters().Select(p => p.ParameterType).ToArray()), |
Copilot uses AI. Check for mistakes.
No description provided.