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

Error on "yard graph" #245

Closed
Zapotek opened this issue Jan 24, 2011 · 9 comments
Closed

Error on "yard graph" #245

Zapotek opened this issue Jan 24, 2011 · 9 comments
Milestone

Comments

@Zapotek
Copy link

Zapotek commented Jan 24, 2011

Hi, I'm trying to run "yard graph" but I get the following error:
/home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/code_objects/base.rb:325:in method_missing': undefined methodsuperclass' for # (NoMethodError)
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/class/dot/superklass.erb:3:in _erb_cache_4' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:238:inerb'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:316:in render_section' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:210:inblock (2 levels) in run'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in each' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:inblock in run'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:345:in add_options' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:206:inrun'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:91:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:319:inrender_section'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:210:in block (2 levels) in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:ineach'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in block in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:351:inadd_options'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:206:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:228:inblock in yieldall'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:359:in with_section' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:228:inyieldall'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/header.erb:6:in block in _erb_cache_3' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/header.erb:5:ineach'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/header.erb:5:in _erb_cache_3' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:238:inerb'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:316:in render_section' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:210:inblock (2 levels) in run'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in each' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:inblock in run'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:345:in add_options' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:206:inrun'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:91:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:319:inrender_section'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:210:in block (2 levels) in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:ineach'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in block in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:351:inadd_options'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:206:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:228:inblock in yieldall'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:359:in with_section' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:228:inyieldall'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/setup.rb:13:in block in classes' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/setup.rb:13:inmap'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/setup.rb:13:in classes' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:314:inrender_section'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:210:in block (2 levels) in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:ineach'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in block in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:345:inadd_options'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:206:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:91:inrun'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:319:in render_section' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:210:inblock (2 levels) in run'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in each' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:inblock in run'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:351:in add_options' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:206:inrun'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:228:in block in yieldall' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:359:inwith_section'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:228:in yieldall' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/header.erb:6:inblock in _erb_cache_3'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/header.erb:5:in each' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/templates/default/module/dot/header.erb:5:in_erb_cache_3'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:238:in erb' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:316:inrender_section'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:210:in block (2 levels) in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:ineach'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in block in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:345:inadd_options'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:206:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/template.rb:91:inrun'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/engine.rb:86:in block in render' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/engine.rb:115:inwith_serializer'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/templates/engine.rb:86:in render' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/code_objects/base.rb:432:informat'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/cli/graph.rb:38:in block in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/cli/graph.rb:38:inmap'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/cli/graph.rb:38:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/cli/command.rb:13:inrun'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/cli/command_parser.rb:67:in run' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/lib/yard/cli/command_parser.rb:49:inrun'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/gems/yard-0.6.4/bin/yard:4:in <top (required)>' from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/bin/yard:19:inload'
from /home/zapotek/.rvm/gems/ruby-1.9.2-p136/bin/yard:19:in `

'

Any ideas?

@Zapotek
Copy link
Author

Zapotek commented Jan 24, 2011

I went though the backtrace and made the following changes:

lib/yard/code_objects/base.rb:325:in method_missing()
def method_missing(meth, *args, &block)
if meth.to_s =~ /=$/
self[meth.to_s[0..-2]] = args.first
elsif instance_variable_get("@#{meth}")
self[meth]
else
begin
super
rescue
end
end
end

templates/default/class/dot/superklass.erb:
<% if object.superclass && object.superclass.path != "Object" %>
<%= format_path object %> -> <%= format_path object.superclass %>;
<% end %>

templates/default/default/module/dor/info.erb:
<%= h(" : #{obj.tag(:return).types.first}") if obj.has_tag?(:return) && obj.tag(:return).types && obj.tag(:return).types.size > 0 %>\l

This is more of a hack though...

@mattetti
Copy link

mattetti commented Feb 1, 2011

Same crash here with Ruby 1.9.2-p136 and yard 0.6.4 but different stack trace:

/gems/yard-0.6.4/templates/default/class/dot/superklass.erb:3:in `_erb_cache_4': undefined method `path' for nil:NilClass (NoMethodError)
/gems/yard-0.6.4/lib/yard/templates/template.rb:238:in `erb'
/gems/yard-0.6.4/lib/yard/templates/template.rb:316:in `render_section'
/gems/yard-0.6.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in `each'
/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in `block in run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:345:in `add_options'
/gems/yard-0.6.4/lib/yard/templates/template.rb:206:in `run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:91:in `run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:319:in `render_section'
/gems/yard-0.6.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in `each'
/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in `block in run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:351:in `add_options'
/gems/yard-0.6.4/lib/yard/templates/template.rb:206:in `run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:228:in `block in yieldall'
/gems/yard-0.6.4/lib/yard/templates/template.rb:359:in `with_section'
/gems/yard-0.6.4/lib/yard/templates/template.rb:228:in `yieldall'
/gems/yard-0.6.4/templates/default/module/dot/setup.rb:13:in `block in classes'
/gems/yard-0.6.4/templates/default/module/dot/setup.rb:13:in `map'
/gems/yard-0.6.4/templates/default/module/dot/setup.rb:13:in `classes'
/gems/yard-0.6.4/lib/yard/templates/template.rb:314:in `render_section'
/gems/yard-0.6.4/lib/yard/templates/template.rb:210:in `block (2 levels) in run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in `each'
/gems/yard-0.6.4/lib/yard/templates/template.rb:207:in `block in run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:345:in `add_options'
/gems/yard-0.6.4/lib/yard/templates/template.rb:206:in `run'
/gems/yard-0.6.4/lib/yard/templates/template.rb:91:in `run'
/gems/yard-0.6.4/lib/yard/templates/engine.rb:86:in `block in render'
/gems/yard-0.6.4/lib/yard/templates/engine.rb:115:in `with_serializer'
/gems/yard-0.6.4/lib/yard/templates/engine.rb:86:in `render'
/gems/yard-0.6.4/lib/yard/code_objects/base.rb:432:in `format'
/gems/yard-0.6.4/lib/yard/cli/graph.rb:38:in `block in run'
/gems/yard-0.6.4/lib/yard/cli/graph.rb:38:in `map'
/gems/yard-0.6.4/lib/yard/cli/graph.rb:38:in `run'
/gems/yard-0.6.4/lib/yard/cli/command.rb:13:in `run'
/gems/yard-0.6.4/lib/yard/cli/command_parser.rb:67:in `run'
/gems/yard-0.6.4/lib/yard/cli/command_parser.rb:49:in `run'
/gems/yard-0.6.4/bin/yard:4:in `<top (required)>'
/bin/yard:19:in `load'
/bin/yard:19:in `<main>'

I "fixed" the superklass.erb template:

<% if object.superclass && object.superclass.path != "Object" %>
  <%= format_path object %> -> <%= format_path object.superclass %>;
<% end %>

@zdavatz
Copy link

zdavatz commented Feb 18, 2011

same issue here with Ruby 1.9.2

@zdavatz
Copy link

zdavatz commented Feb 18, 2011

Ok, fixes work! Thanks!

Best
Zeno

@lsegal
Copy link
Owner

lsegal commented Feb 25, 2011

Can anybody provide a minimal case that reproduces this issue? I've applied mattetti's patch, but I'd like to know how to confirm this is fixing an issue.

Regards

@lsegal
Copy link
Owner

lsegal commented Feb 25, 2011

I've tested it against Arachni and it works. I'll push a commit and close this ticket now.

@lsegal
Copy link
Owner

lsegal commented Feb 25, 2011

Fix invalid parsing of modules as classes in yard graph template

Closed by 9d5fccd

@zdavatz
Copy link

zdavatz commented Feb 25, 2011

Thank you for taking care of this!

@mattetti
Copy link

Thanks indeed, I'll check that it works properly on my current project.

This issue was closed.
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

4 participants