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

Errors when run on IRB code #1327

Closed
qortex opened this issue May 3, 2020 · 1 comment
Closed

Errors when run on IRB code #1327

qortex opened this issue May 3, 2020 · 1 comment

Comments

@qortex
Copy link

qortex commented May 3, 2020

Errors when running gem install irb with auto yard doc enabled:

$ gem install irb
Fetching irb-1.2.4.gem
Successfully installed irb-1.2.4
Building YARD (yri) index for irb-1.2.4...
[error]: Unhandled exception in YARD::Handlers::Ruby::PrivateConstantHandler:
  in `lib/irb/color.rb`:67:

	67: private_constant :TOKEN_SEQ_EXPRS

[error]: RangeError: cannot get the first element of beginless range
[error]: Stack trace:
	/home/mic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ast_node.rb:274:in `first'
	/home/mic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ast_node.rb:274:in `line'
	/home/mic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ruby_parser.rb:623:in `block in insert_comments'
	/home/mic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ast_node.rb:212:in `traverse'
	/home/mic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ruby_parser.rb:614:in `insert_comments'
	/home/mic/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/yard-0.9.24/lib/yard/parser/ruby/ruby_parser.rb:60:in `parse'

Done installing documentation for irb after 0 seconds
1 gem installed

Environment details:

  • OS: Fedora 31
  • Ruby version: ruby 2.7.1p83 with rbenv
  • YARD version: yard 0.9.24
lsegal added a commit that referenced this issue May 3, 2020
Resolves "beginless range" error.

Fixes #1308, #1324, #1326, #1327
@lsegal
Copy link
Owner

lsegal commented May 3, 2020

Fixed in e3e8321

@lsegal lsegal closed this as completed May 3, 2020
lsegal added a commit that referenced this issue May 3, 2020
iftheshoefritz added a commit to iftheshoefritz/solargraph-rails that referenced this issue Sep 30, 2022
Yard gems exits with `1` in ruby 3.1.0 builds; since that doesn't seem to cause
the tests to fail, just capture the error code and display it.

The error (visible when running with --debug) looks like:

```
~/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ast_node.rb:274:in `first': cannot get the first element of beginless range (RangeError)
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ast_node.rb:274:in `line'
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ruby_parser.rb:624:in `block in insert_comments'
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ast_node.rb:212:in `traverse'
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ruby_parser.rb:615:in `insert_comments'
        ...
 ```

Which seems a lot like this issue in the YARD project:
lsegal/yard#1327

However that is ostensibly fixed in yard v0.9.25 and I am running v0.9.28. I'm
not interested in debugging YARD and this doesn't feel like an awful workaround.
iftheshoefritz added a commit to iftheshoefritz/solargraph-rails that referenced this issue Sep 30, 2022
Yard gems exits with `1` in ruby 3.1.0 builds; since that doesn't seem to cause
the tests to fail, just continue the build.

This is a cheeky option, we should probably split the bundle install and yard
gems commands, or do a check for the version of Ruby. My bash skills were
failing me so now I am trying this.

The error (visible when running with --debug) looks like:

```
~/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ast_node.rb:274:in `first': cannot get the first element of beginless range (RangeError)
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ast_node.rb:274:in `line'
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ruby_parser.rb:624:in `block in insert_comments'
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ast_node.rb:212:in `traverse'
        from /Users/frederickmeissner/.asdf/installs/ruby/3.1.0/lib/ruby/gems/3.1.0/gems/yard-0.9.28/lib/yard/parser/ruby/ruby_parser.rb:615:in `insert_comments'
        ...
 ```

Which seems a lot like this issue in the YARD project:
lsegal/yard#1327

However that is ostensibly fixed in yard v0.9.25 and I am running v0.9.28. I'm
not interested in debugging YARD and this doesn't feel like an awful workaround.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants