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

Unhandled exception in YARD::Handlers::Ruby::MethodHandler #614

Closed ssimeonov closed 11 years ago

ssimeonov commented 11 years ago

When processing the included Ruby file, YARD generates the following output:

2047[SPX/internal(ss_yard *)]$ yardoc
[error]: Unhandled exception in YARD::Handlers::Ruby::MethodHandler:
[error]:   in `doc/pub_sub.rb`:11:

    11: def notify(resource, opts = {})

[error]: NoMethodError: undefined method `length' for nil:NilClass
[error]: Stack trace:
    /Users/sim/.rvm/gems/ruby-1.9.2-p290@shopximity/gems/yard-0.8.2.1/lib/yard/tags/default_factory.rb:139:in `extract_types_and_name_from_text_unstripped'
    /Users/sim/.rvm/gems/ruby-1.9.2-p290@shopximity/gems/yard-0.8.2.1/lib/yard/tags/default_factory.rb:126:in `extract_types_and_name_from_text'
    /Users/sim/.rvm/gems/ruby-1.9.2-p290@shopximity/gems/yard-0.8.2.1/lib/yard/tags/default_factory.rb:76:in `parse_tag_with_types_name_and_default'
    /Users/sim/.rvm/gems/ruby-1.9.2-p290@shopximity/gems/yard-0.8.2.1/lib/yard/tags/default_factory.rb:88:in `parse_tag_with_options'
    /Users/sim/.rvm/gems/ruby-1.9.2-p290@shopximity/gems/yard-0.8.2.1/lib/yard/tags/library.rb:237:in `send_to_factory'
    /Users/sim/.rvm/gems/ruby-1.9.2-p290@shopximity/gems/yard-0.8.2.1/lib/yard/tags/library.rb:172:in `option_tag'

Files:           1
Modules:         1 (    1 undocumented)
Classes:         0 (    0 undocumented)
Constants:       0 (    0 undocumented)
Methods:         2 (    1 undocumented)
 33.33% documented

The Ruby code that causes this is:

module PubSub

  module_function

  # Publishes a notification
  #
  # @param [String] resource the name of the resource
  # @param [Hash] opts the options to create a message with.
  # @option opts [String, Symbol] :action the action to notify about
  # @option opts [Object] :payload (nil) The notification payload
  def notify(resource, opts = {})
  end

end

Removing either the opts documentation or module_function eliminates the problem.

lsegal commented 11 years ago

Fixed by #563, upgrading to 0.8.3 will fix this issue.