Skip to content
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

:nodoc: on enum member does not also hide the generated question method #11333

Closed
Blacksmoke16 opened this issue Oct 17, 2021 · 6 comments · Fixed by #15379
Closed

:nodoc: on enum member does not also hide the generated question method #11333

Blacksmoke16 opened this issue Oct 17, 2021 · 6 comments · Fixed by #15379

Comments

@Blacksmoke16
Copy link
Member

If you define an enum with a :nodoc: member, like:

enum Test
  FOO

  # :nodoc:
  BAR
end

The member itself will be hidden, but the autogenerated bar? method ill not:

image

I think it would make sense to also hide the method.

@Blacksmoke16 Blacksmoke16 added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Oct 17, 2021
@asterite
Copy link
Member

Pretty hard, the regular compiler doesn't know about doc comments.

@straight-shoota
Copy link
Member

What would be a use case for a nodoc enum member anyways?

@straight-shoota straight-shoota added status:discussion topic:tools:docs-generator and removed kind:bug A bug in the code. Does not apply to documentation, specs, etc. labels Oct 18, 2021
@asterite
Copy link
Member

What I said doesn't make sense, sorry.

Regex options are one place where there are nodoc values.

@Blacksmoke16
Copy link
Member Author

Yea Regex::Options is where i noticed it. Granted, probably a bit of an edge case.

@straight-shoota
Copy link
Member

Thanks to @nobodywasishere for pushing #15375. But I'm not quite sure that's the correct solution for this.
In principle, duplicating documentation is quite poor, especially when it's not explicitly declared for the user. They'll have to read both documentations without realizing that they're identical and one or the other would suffice.

Instead, it should be better to refer to the primary documentation instead of copying the contents.

This particular issue didn't even ask to duplicate the documentation of the enum member. It's just about making derived predicate methods nodoc. It should be possible to do that without copying the entire doc comment.
However, it might be a good idea to generate a generic doc comment for enum methods which describe the function and refer to the member.
Something like this:

# Returns `true` if this enum value {{ flag_type? ? "contains" : "equals" }} `{{ member }}`.

@nobodywasishere
Copy link
Contributor

Fair enough, I'll update it accordingly. Adding that documentation also sounds like a good idea. I can check if the enum member starts with :nodoc: and append it to the helper method if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants