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

Don't document aliases with trailing :nodoc directive #1090

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/rdoc/parser/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -789,8 +789,10 @@ def parse_alias(context, single, tk, comment)
al.line = line_no

read_documentation_modifiers al, RDoc::ATTR_MODIFIERS
context.add_alias al
@stats.add_alias al
if al.document_self or not @track_visibility
context.add_alias al
@stats.add_alias al
end

al
end
Expand Down
22 changes: 22 additions & 0 deletions test/rdoc/test_rdoc_parser_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3065,6 +3065,28 @@ def test_parse_statements_identifier_yields
assert_nil m.params, 'Module parameter not removed'
end

def test_parse_statements_nodoc_identifier_alias
klass = @top_level.add_class RDoc::NormalClass, 'Foo'

util_parser "\nalias :old :new # :nodoc:"

@parser.parse_statements klass, RDoc::Parser::Ruby::NORMAL, nil

assert_empty klass.aliases
assert_empty klass.unmatched_alias_lists
end

def test_parse_statements_nodoc_identifier_alias_method
klass = @top_level.add_class RDoc::NormalClass, 'Foo'

util_parser "\nalias_method :old :new # :nodoc:"

@parser.parse_statements klass, RDoc::Parser::Ruby::NORMAL, nil

assert_empty klass.aliases
assert_empty klass.unmatched_alias_lists
end

def test_parse_statements_stopdoc_alias
klass = @top_level.add_class RDoc::NormalClass, 'Foo'

Expand Down
Loading