Skip to content
This repository was archived by the owner on Aug 9, 2022. It is now read-only.

implement comment inheritance for methods#40

Merged
anmeng10101 merged 1 commit intodevelopfrom
addCommentInheritance
Jun 4, 2020
Merged

implement comment inheritance for methods#40
anmeng10101 merged 1 commit intodevelopfrom
addCommentInheritance

Conversation

@anmeng10101
Copy link
Copy Markdown
Collaborator

https://dev.azure.com/ceapex/Engineering/_workitems/edit/225426/

Changes in this pr includes:

  1. Implement comment inheritance.
  2. Add new package for integration test of different scenarios.

@anmeng10101 anmeng10101 force-pushed the addCommentInheritance branch from c69fcab to 4cc037b Compare June 3, 2020 05:30
@anmeng10101 anmeng10101 force-pushed the addCommentInheritance branch from 4cc037b to 9fb9344 Compare June 3, 2020 07:03
Comment thread src/main/java/com/microsoft/util/Utils.java
Copy link
Copy Markdown

@joelmartinez joelmartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this LGTM ... I left a few comments, but will mark the PR as approved from my perspective, as they are just somewhat subjective comments that you very well may have a logical answer for how you did it :) great work.

*
* @return true if there are no comments, false otherwise
*/
public boolean isSimpleOverride() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we might be able to find a better name for this member? according to the comment, it will return true if there are no comments or there's an inheritDoc ... however in usage, it seems this is used to determine when docs should be inherited or not.

So perhaps it might be better to name it with the purpose ... the actual signal that it sends ... something like public boolean shouldInheritDocs() ?

Copy link
Copy Markdown
Collaborator Author

@anmeng10101 anmeng10101 Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, will re-think for better way to describe following 2 status.

  • No comment for this method.
  • There is {@inheritDoc} tag, and also its own comments.


List<? extends DocTree> inheritInlineTags(CommentHelper origin, CommentHelper chInheritFrom) {
List<DocTree> mergedTags = new ArrayList<>();
if (!origin.isSimpleOverride() && !origin.hasInheritDocTag) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't isSimpleOverride already call hasInheritDocTag? Are there scenarios where isSimpleOverride() would return false, but hasInheritDocTag would return true?

you're more familiar with this codebase/logic so this very well may be the case, but it seems like a candidate for simplification of logic

Copy link
Copy Markdown
Collaborator Author

@anmeng10101 anmeng10101 Jun 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Will re-think for this, simplification seems possible.

My initial thinking was to separate the 2 different actions.

Case 1 - The method has no comment or have only {@inheritedDoc}. For these methods we just simply assign inlineTags of its overridden or implemented item to it.

    @Override
    public String getName() {};

    /**
     * {@inheritDoc}
     */
    @Override
    public String getVersion() {};

Case 2 - The method has comment and {@inheritedDoc}. For these methods we just copy comments and merge with it's own comment with some collection operations.

    /**
     * Get version from an item
     * {@inheritDoc}
     */
    @Override
    public String getVersion() {};

@anmeng10101 anmeng10101 merged commit 78fc76a into develop Jun 4, 2020
anmeng10101 added a commit to anmeng10101/docfx-doclet that referenced this pull request Jun 5, 2020
@anmeng10101 anmeng10101 deleted the addCommentInheritance branch December 31, 2020 07:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants