lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

YARD Server - Error viewing documentation for Capybara #393

Closed tmorton closed 12 years ago

tmorton commented 12 years ago

Summary: When viewing the documentation for Capybara 0.3.7, the class list in the left frame is not rendered, and the server console shows this stack trace:

[2011-10-07 14:35:43] ERROR NoMethodError: undefined method `name' for nil:NilClass
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/setup.rb:185:in `class_list'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/setup.rb:178:in `map'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/setup.rb:178:in `class_list'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/setup.rb:194:in `class_list'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/setup.rb:178:in `map'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/setup.rb:178:in `class_list'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/full_list_class.erb:2:in `_erb_cache_8'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:238:in `send'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:238:in `erb'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/templates/doc_server/full_list/html/full_list.erb:29:in `_erb_cache_7'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:238:in `send'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:238:in `erb'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/templates/default/fulldoc/html/setup.rb:150:in `generate_class_list'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/templates/doc_server/full_list/html/setup.rb:6:in `init'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:144:in `initialize'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:86:in `send'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:86:in `new'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/template.rb:91:in `run'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/templates/engine.rb:88:in `render'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/commands/base.rb:143:in `render'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/commands/list_command.rb:14:in `run'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/commands/base.rb:95:in `call'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/commands/library_command.rb:49:in `call'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/router.rb:157:in `route_list'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/router.rb:109:in `route'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/router.rb:54:in `call'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/rack_adapter.rb:51:in `call'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.2.3/lib/rack/content_length.rb:13:in `call'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.2.3/lib/rack/handler/webrick.rb:52:in `service'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:162:in `start'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:95:in `start'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:92:in `each'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:92:in `start'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:23:in `start'
/Users/tim/.rvm/rubies/ree-1.8.7-2010.01/lib/ruby/1.8/webrick/server.rb:82:in `start'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.2.3/lib/rack/handler/webrick.rb:13:in `run'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.2.3/lib/rack/server.rb:217:in `start'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/server/rack_adapter.rb:61:in `start'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/cli/server.rb:44:in `run'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/cli/command.rb:13:in `run'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/cli/command_parser.rb:68:in `run'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/lib/yard/cli/command_parser.rb:50:in `run'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/gems/yard-0.7.2/bin/yard:4
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/bin/yard:19:in `load'
/Users/tim/.rvm/gems/ree-1.8.7-2010.01/bin/yard:19

This occurs with yard gem 0.7.2.

The immediate cause is this line: out << " < #{child.superclass.name}" if child.is_a?(CodeObjects::ClassObject) && child.superclass

A bit of investigation has revealed that child.superclass at this point is a YARD::StubProxy for nil. That proxy object is truthy, so the test at the end of the line passes, but the proxied object is nil, so the call to .name throws an exception.

lsegal commented 12 years ago

Seems to work for me in 1.9.3dev and 1.8.7. Try deleting your .yardoc and regenerating yard -n? Seems like it might be a corrupt yard db, that StubProxy shouldnt never show up.

lsegal commented 12 years ago

FYI it also works just fine on rubydoc.info: http://rubydoc.info/gems/cucumber/0.3.7/frames, so...

tmorton commented 12 years ago

On a different machine (my home machine), I don't get this problem. I'll try regenerating the .yardoc on the affected machine on Tuesday, but I guess this is a non-issue.

lsegal commented 12 years ago

Thanks for confirming. I'll close this issue for now, but if the problem persists on your other machine feel free to come back and reopen/comment.