YARD - @param tag has unknown parameter name

456 views Asked by At

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?

1

There are 1 answers

0
Tina Bell Vance On

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.