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

Omit descriptions and parameter lists for methods defined in C not mentioned in call-seq #978

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

jeremyevans
Copy link
Contributor

This allows RDoc to better generate documentation for methods following the Ruby core documentation guide (which omits aliases in call-seq in most cases). This makes documentation for methods defined in C more similar to methods defined in Ruby. For methods defined in Ruby, the method description of the aliased method is already not used (you have to explicitly document the alias to use it).

Internally, this adds AnyMethod#has_call_seq? and #skip_description?, and updates Darkfish to:

  • only show the method name if there is a call-seq for the method, but the call-seq omits the method
  • to omit the method description if the method is an alias or has aliases and has a call-seq that does not include the method

See discussion in ruby/ruby#7316 for discussion leading to this pull request.

…ntioned in call-seq

This allows RDoc to better generate documentation for methods
following the Ruby core documentation guide (which omits aliases
in call-seq in most cases).  This makes documentation for methods
defined in C more similar to methods defined in Ruby.  For methods
defined in Ruby, the method description of the aliased method is
already not used (you have to explicitly document the alias to
use it).

Internally, this adds AnyMethod#has_call_seq? and #skip_description?,
and updates Darkfish to:

* only show the method name if there is a call-seq for the method,
  but the call-seq omits the method
* to omit the method description if the method is an alias or has
  aliases and has a call-seq that does not include the method

See discussion in ruby/ruby#7316 for
details.
@zzak
Copy link
Member

zzak commented Feb 22, 2023

@jeremyevans I appreciate the vote of confidence in requesting my review, but I'm not too familiar with this part of RDoc. You probably have more context then I do, we can ask in slack about getting you commit access if that helps.

Happy to pull this down and try it out too if that is helpful!

@jeremyevans
Copy link
Contributor Author

@zzak That's OK, I just requested review from you as I saw you had recent commits. I already have commit access, so I could merge this myself, but I thought it best to have it reviewed by someone possibly more familiar with the internals. Taking another look at the commit log, maybe I can ask @nobu.

@jeremyevans jeremyevans requested a review from nobu February 22, 2023 16:00
Copy link
Member

@nobu nobu left a comment

Choose a reason for hiding this comment

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

Generally looks good.

# aliases with a call-seq that doesn't include the method name.

def skip_description?
has_call_seq? && call_seq.nil? && !!(is_alias_for || !aliases.empty?)
Copy link
Member

Choose a reason for hiding this comment

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

The condition around aliases with has_call_seq? seems complicated a little.

@nobu nobu merged commit e3688de into ruby:master Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants