You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tags for the last reader attribute of a list of attributes are ignored.
Steps to reproduce
Test file /tmp/tst.rb:
class TwoAttrs
#
# @!attribute [r] attr1
# This first attribute.
# @return [String]
#
# @!attribute [r] attr2
# This second, and yet more important, attribute.
# @return [Integer]
#
attr_reader :attr1, :attr2
end
Actual Output
$ yard doc --no-private --debug /tmp/tst.rb
[debug]: Parsing ["/tmp/tst.rb"] with ruby parser
[debug]: Parsing /tmp/tst.rb
[debug]: Serializing to .yardoc/objects/root.dat
[debug]: Re-generating object ...
[debug]: Re-generating object TwoAttrs...
[debug]: Generating asset js/jquery.js
[debug]: Serializing to doc/js/jquery.js
[debug]: Generating asset js/app.js
[debug]: Serializing to doc/js/app.js
[debug]: Generating asset js/full_list.js
[debug]: Serializing to doc/js/full_list.js
[debug]: Generating asset css/style.css
[debug]: Serializing to doc/css/style.css
[debug]: Generating asset css/common.css
[debug]: Serializing to doc/css/common.css
[debug]: Generating asset css/full_list.css
[debug]: Serializing to doc/css/full_list.css
[debug]: Generating asset class_list.html
[debug]: Serializing to doc/class_list.html
[debug]: Generating asset method_list.html
[debug]: Serializing to doc/method_list.html
[debug]: Generating asset file_list.html
[debug]: Serializing to doc/file_list.html
[debug]: Generating asset frames.html
[debug]: Serializing to doc/frames.html
[debug]: Serializing to doc/index.html
[debug]: Serializing to doc/_index.html
[debug]: Serializing to doc/top-level-namespace.html
[debug]: Serializing to doc/TwoAttrs.html
Files: 1
Modules: 0 ( 0 undocumented)
Classes: 1 ( 1 undocumented)
Constants: 0 ( 0 undocumented)
Attributes: 2 ( 0 undocumented)
Methods: 0 ( 0 undocumented)
66.67% documented
Note: If I replace 'attr_reader' with 'attr_accessor' (and replace '[r]' with '[rw]'), the behavior is as expected.
Expected Output
Instead of "#attr2 -> Object" it should read "#attr2 -> Integer" and instead of "Returns the value of attribute attr2" is should read "The second, and yet more important, attribute".
Environment details:
OS: $ uname -a
Linux oroshi 2.6.32-696.13.2.el6.x86_64 attr_reader registers as RW #1 SMP Fri Sep 22 12:32:14 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
Description
The tags for the last reader attribute of a list of attributes are ignored.
Steps to reproduce
Test file /tmp/tst.rb:
class TwoAttrs # # @!attribute [r] attr1 # This first attribute. # @return [String] # # @!attribute [r] attr2 # This second, and yet more important, attribute. # @return [Integer] # attr_reader :attr1, :attr2 endActual Output
$ yard doc --no-private --debug /tmp/tst.rb
[debug]: Parsing ["/tmp/tst.rb"] with
rubyparser[debug]: Parsing /tmp/tst.rb
[debug]: Serializing to .yardoc/objects/root.dat
[debug]: Re-generating object ...
[debug]: Re-generating object TwoAttrs...
[debug]: Generating asset js/jquery.js
[debug]: Serializing to doc/js/jquery.js
[debug]: Generating asset js/app.js
[debug]: Serializing to doc/js/app.js
[debug]: Generating asset js/full_list.js
[debug]: Serializing to doc/js/full_list.js
[debug]: Generating asset css/style.css
[debug]: Serializing to doc/css/style.css
[debug]: Generating asset css/common.css
[debug]: Serializing to doc/css/common.css
[debug]: Generating asset css/full_list.css
[debug]: Serializing to doc/css/full_list.css
[debug]: Generating asset class_list.html
[debug]: Serializing to doc/class_list.html
[debug]: Generating asset method_list.html
[debug]: Serializing to doc/method_list.html
[debug]: Generating asset file_list.html
[debug]: Serializing to doc/file_list.html
[debug]: Generating asset frames.html
[debug]: Serializing to doc/frames.html
[debug]: Serializing to doc/index.html
[debug]: Serializing to doc/_index.html
[debug]: Serializing to doc/top-level-namespace.html
[debug]: Serializing to doc/TwoAttrs.html
Files: 1
Modules: 0 ( 0 undocumented)
Classes: 1 ( 1 undocumented)
Constants: 0 ( 0 undocumented)
Attributes: 2 ( 0 undocumented)
Methods: 0 ( 0 undocumented)
66.67% documented
Note: If I replace 'attr_reader' with 'attr_accessor' (and replace '[r]' with '[rw]'), the behavior is as expected.
Expected Output
Instead of "#attr2 -> Object" it should read "#attr2 -> Integer" and instead of "Returns the value of attribute attr2" is should read "The second, and yet more important, attribute".
Environment details:
Linux oroshi 2.6.32-696.13.2.el6.x86_64 attr_reader registers as RW #1 SMP Fri Sep 22 12:32:14 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
yard 0.9.9
Also tested with Ruby 2.4:
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
I have read the Contributing Guide.