Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YARD - @param tag has unknown parameter name

Tags:

ruby

yard

I'm trying to document my code using YARD, however I'm having hard time figuring out how to get rid of following warning:

   $ ~/.gem/ruby/2.3.0/bin/yard 
[warn]: @param tag has unknown parameter name: val 
    in file `lib/wolfsden_myanimelist/values.rb' near line 22
Files:           4
Modules:         2 (    2 undocumented)
Classes:         4 (    2 undocumented)
Constants:       6 (    6 undocumented)
Attributes:     14 (    0 undocumented)
Methods:         4 (    0 undocumented)
 66.67% documented

In the following code:

    # @overload episode
    #   Gets last seen episode.
    #   @return [Integer] last seen episode
    # @overload episode=(val)
    #   Sets last seen episode.
    #   @param val last seen episode
    attr_reader :episode
    def episode=(val)
        @status = Integer(val)
    end

However I believe this is exactly how documentation ( http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md#Documentation_for_a_Separate_Attribute_Writer ) recommends to do it. So, how can I get rid of the warning?

like image 598
graywolf Avatar asked Nov 09 '22 04:11

graywolf


1 Answers

I believe what you need to do is supply a data type for the parameter. It would look like this:

# @overload episode
#   Gets last seen episode.
# @overload episode=(val)
#   Sets last seen episode.
#   @param [String, Integer] val Last seen episode
#   @return [Integer] Last seen episode
attr_reader :episode
def episode=(val)
    @status = Integer(val)
end

You can have more than one data type in a parameter -- I put String and Integer in, because a user could put in either.

like image 116
Tina Bell Vance Avatar answered Dec 16 '22 23:12

Tina Bell Vance