Skip to content

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

Merged
merged 5 commits into from
Apr 2, 2025

Conversation

a-gubskiy
Copy link
Collaborator

No description provided.

@a-gubskiy a-gubskiy requested a review from Copilot April 2, 2025 20:57
Copy link
Contributor

@Copilot Copilot AI left a 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)
Copy link
Preview

Copilot AI Apr 2, 2025

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.

Comment on lines +82 to 83
[.. methodInfo.GetParameters().Select(p => p.ParameterType)]),

Copy link
Preview

Copilot AI Apr 2, 2025

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.

Suggested change
[.. methodInfo.GetParameters().Select(p => p.ParameterType)]),
methodInfo.GetParameters().Select(p => p.ParameterType).ToArray()),

Copilot uses AI. Check for mistakes.

@a-gubskiy a-gubskiy merged commit f145ead into main Apr 2, 2025
3 checks passed
@a-gubskiy a-gubskiy deleted the plaintext-render branch April 2, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants