lsegal/yard

private_class_method may kill parameter documentation

Closed this issue · 2 comments

The following source code:

class Foo
  # @param [Numeric] a
  # @return [Numeric]
  private_class_method def self.foo(a)
    a + 1
  end
end

Results in a warning:

[warn]: @param tag has unknown parameter name: a 
    in file `yardoc.rb' near line 4

The warning is gone if the @return tag is removed, or if the private_class_method modifier is removed.

Environment details:

  • OS: Ubuntu 16.10, kernel 4.10.0-42-generic
  • Ruby version (ruby -v): ruby 2.3.3p222 (2016-11-21) [i386-linux-gnu]
  • YARD version (yard -v): yard 0.9.12

I have read the Contributing Guide.

This is a known issue-- (private|public)_class_method is not supported as an inline prefix to defs, just as public or private prefixes are also not yet supported. A PR would be accepted to add support.

As a workaround, you can use the old syntax of:

class Foo
  def self.foo(a) a + 1 end
  private_class_method :foo
end

Closing out old issues. Please re-open or open a fresh issue with new context if this is still affecting you.