-
Notifications
You must be signed in to change notification settings - Fork 440
Expand single-letter variable names for better readability #1313
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,12 +289,12 @@ def handle_meta_method_comment(comment, node) | |
|
||
if attributes | ||
attributes.each do |attr| | ||
a = RDoc::Attr.new(@container, attr, rw, processed_comment, singleton: @singleton) | ||
Comment on lines
291
to
-292
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. attributes.each do |name|
attr = RDoc::Attr.new(@container, name, ...) or attributes.each do |attr_name|
attr = RDoc::Attr.new(@container, attr_name, ...) may be better. |
||
a.store = @store | ||
a.line = line_no | ||
record_location(a) | ||
@container.add_attribute(a) | ||
a.visibility = visibility | ||
attr_obj = RDoc::Attr.new(@container, attr, rw, processed_comment, singleton: @singleton) | ||
attr_obj.store = @store | ||
attr_obj.line = line_no | ||
record_location(attr_obj) | ||
@container.add_attribute(attr_obj) | ||
attr_obj.visibility = visibility | ||
end | ||
elsif line_no || node | ||
method_name ||= call_node_name_arguments(node).first if is_call_node | ||
|
@@ -401,13 +401,13 @@ def visible_tokens_from_location(location) | |
|
||
def change_method_visibility(names, visibility, singleton: @singleton) | ||
new_methods = [] | ||
@container.methods_matching(names, singleton) do |m| | ||
if m.parent != @container | ||
m = m.dup | ||
record_location(m) | ||
new_methods << m | ||
@container.methods_matching(names, singleton) do |method| | ||
if method.parent != @container | ||
method = method.dup | ||
record_location(method) | ||
new_methods << method | ||
else | ||
m.visibility = visibility | ||
method.visibility = visibility | ||
end | ||
end | ||
new_methods.each do |method| | ||
|
@@ -449,13 +449,13 @@ def add_alias_method(old_name, new_name, line_no) | |
comment = consecutive_comment(line_no) | ||
handle_consecutive_comment_directive(@container, comment) | ||
visibility = @container.find_method(old_name, @singleton)&.visibility || :public | ||
a = RDoc::Alias.new(nil, old_name, new_name, comment, singleton: @singleton) | ||
handle_modifier_directive(a, line_no) | ||
a.store = @store | ||
a.line = line_no | ||
record_location(a) | ||
if should_document?(a) | ||
@container.add_alias(a) | ||
alias_obj = RDoc::Alias.new(nil, old_name, new_name, comment, singleton: @singleton) | ||
handle_modifier_directive(alias_obj, line_no) | ||
alias_obj.store = @store | ||
alias_obj.line = line_no | ||
record_location(alias_obj) | ||
if should_document?(alias_obj) | ||
@container.add_alias(alias_obj) | ||
@container.find_method(new_name, @singleton)&.visibility = visibility | ||
end | ||
end | ||
|
@@ -468,13 +468,13 @@ def add_attributes(names, rw, line_no) | |
return unless @container.document_children | ||
|
||
names.each do |symbol| | ||
a = RDoc::Attr.new(nil, symbol.to_s, rw, comment, singleton: @singleton) | ||
a.store = @store | ||
a.line = line_no | ||
record_location(a) | ||
handle_modifier_directive(a, line_no) | ||
@container.add_attribute(a) if should_document?(a) | ||
a.visibility = visibility # should set after adding to container | ||
attr_obj = RDoc::Attr.new(nil, symbol.to_s, rw, comment, singleton: @singleton) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
attr_obj.store = @store | ||
attr_obj.line = line_no | ||
record_location(attr_obj) | ||
handle_modifier_directive(attr_obj, line_no) | ||
@container.add_attribute(attr_obj) if should_document?(attr_obj) | ||
attr_obj.visibility = visibility # should set after adding to container | ||
end | ||
end | ||
|
||
|
@@ -483,11 +483,11 @@ def add_includes_extends(names, rdoc_class, line_no) # :nodoc: | |
comment = consecutive_comment(line_no) | ||
handle_consecutive_comment_directive(@container, comment) | ||
names.each do |name| | ||
ie = @container.add(rdoc_class, name, '') | ||
ie.store = @store | ||
ie.line = line_no | ||
ie.comment = comment | ||
record_location(ie) | ||
include_extend_obj = @container.add(rdoc_class, name, '') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may be able to remote |
||
include_extend_obj.store = @store | ||
include_extend_obj.line = line_no | ||
include_extend_obj.comment = comment | ||
record_location(include_extend_obj) | ||
end | ||
end | ||
|
||
|
@@ -652,10 +652,10 @@ def add_constant(constant_name, rhs_name, start_line, end_line) | |
@container.find_module_named(rhs_name) | ||
end | ||
if mod && constant.document_self | ||
a = @container.add_module_alias(mod, rhs_name, constant, @top_level) | ||
a.store = @store | ||
a.line = start_line | ||
record_location(a) | ||
module_alias = @container.add_module_alias(mod, rhs_name, constant, @top_level) | ||
module_alias.store = @store | ||
module_alias.line = start_line | ||
record_location(module_alias) | ||
end | ||
end | ||
|
||
|
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.
head
or something may be better.