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
On parsing our repo, yardoc fails with cannot get the first element of beginless range (RangeError).
The --debug option tells the name of the file that got parsed when the error occured.
While trying to narrow down the source of the error, I noticed that for example a line that includes multiple instructions on a single line (separated with a semicolon) seems to cause this issue.
There might be other ways to cause this issue, but so far I identified several files where it fails at lines with multiple instructions.
Steps to reproduce
Add the line puts "#{if var; 'yes'; else 'nope'; end}" to a ruby file
Run the following command: yardoc <filename.rb>
Actual Output
[debug]: Parsing path/to/file.rb
Traceback (most recent call last):
28: from /home/vagrant/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
27: from /home/vagrant/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
26: from /home/vagrant/.rvm/gems/ruby-2.7.0/bin/yard:23:in `<main>'
25: from /home/vagrant/.rvm/gems/ruby-2.7.0/bin/yard:23:in `load'
24: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/bin/yard:13:in `<top (required)>'
23: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/cli/command_parser.rb:54:in `run'
22: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/cli/command_parser.rb:72:in `run'
21: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/cli/command.rb:14:in `run'
20: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/cli/yardoc.rb:258:in `run'
19: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/registry.rb:210:in `lock_for_writing'
18: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/registry_store.rb:202:in `lock_for_writing'
17: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/serializers/yardoc_serializer.rb:56:in `lock_for_writing'
16: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/cli/yardoc.rb:259:in `block in run'
15: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard.rb:20:in `parse'
14: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/source_parser.rb:113:in `parse'
13: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/logging.rb:182:in `enter_level'
12: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/source_parser.rb:114:in `block in parse'
11: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/source_parser.rb:371:in `parse_in_order'
10: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/source_parser.rb:45:in `parse'
9: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/logging.rb:82:in `capture'
8: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/source_parser.rb:46:in `block in parse'
7: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/source_parser.rb:442:in `parse'
6: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ruby_parser.rb:17:in `parse'
5: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ruby_parser.rb:60:in `parse'
4: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ruby_parser.rb:614:in `insert_comments'
3: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ast_node.rb:212:in `traverse'
2: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ruby_parser.rb:623:in `block in insert_comments'
1: from /home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ast_node.rb:274:in `line'
/home/vagrant/.rvm/gems/ruby-2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ast_node.rb:274:in `first': cannot get the first element of beginless range (RangeError)
Expected Output
Ruby file gets parsed and documentation created.
Environment details:
OS: Ubuntu 18.04
Ruby version (ruby -v): ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
On parsing our repo, yardoc fails with
cannot get the first element of beginless range (RangeError)
.The --debug option tells the name of the file that got parsed when the error occured.
While trying to narrow down the source of the error, I noticed that for example a line that includes multiple instructions on a single line (separated with a semicolon) seems to cause this issue.
There might be other ways to cause this issue, but so far I identified several files where it fails at lines with multiple instructions.
Steps to reproduce
puts "#{if var; 'yes'; else 'nope'; end}"
to a ruby fileyardoc <filename.rb>
Actual Output
Expected Output
Ruby file gets parsed and documentation created.
Environment details:
ruby -v
): ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]yard -v
): yard 0.9.24I have read the Contributing Guide.
The text was updated successfully, but these errors were encountered: