6

I was trying to document some Ruby code using yardand even though I am doing exactly what is described here or here

# @param [Integer] the number of trials (>= 0)
# @param [Float] success probability in each trial
def initialize(n, p)
  # initialize...
end 

I still get this strange error though

@param tag has unknown parameter name: the
@param tag has unknown parameter name: success

and then the generated html looks wierd. I am calling yard this:

$ yard doc -m markdown

What could I be doing wrong?

kmikael
  • 4,962
  • 3
  • 32
  • 34

1 Answers1

10

doc says @param tag has format

@param [Type] name description

and your lines do not include param names (n and p respectively)

keymone
  • 8,006
  • 1
  • 28
  • 33
  • 2
    Thanks a lot! I hadn't noticed it. it's not very clear from looking at the examples at the [getting started document](http://rubydoc.info/docs/yard/file/docs/GettingStarted.md#Reference_Tags) – kmikael Jul 03 '12 at 14:41
  • 1
    indeed it's very easy to miss that param name is required in there. glad i could help you, cheers! – keymone Jul 03 '12 at 16:04
  • 3
    As of Yard 0.8.7.3, the syntax is `@param name [Types] description`. – karatedog Jan 18 '14 at 11:34
  • @karatedog Yes, but the old one still seems to work. – Franklin Yu Dec 12 '16 at 10:08