zverok/yard-junk

False positives with private_class_method & @return

wintersolutions opened this issue · 2 comments

  module Foo
    # @param name [String] a name
    # @return [String] a hello
    private_class_method def self.say_hello(name)
                           "hello #{name}"
                         end
  end

produces problems:

$ yard-junk

Running YardJunk janitor (version 0.0.7)...


Problems
--------
mistyped tags or other typos in documentation

lib/tmp.rb:3: [UnknownParam] @param tag has unknown parameter name: name

0 failures, 1 problems 

The next two examples with slight changes are valid & don't have problems:

No private_class_method:

  module Foo
    # @param name [String] a name
    # @return [String] a hello
    def self.say_hello(name)
      "hello #{name}"
    end
  end

No @return:

  module Foo
    # @param name [String] a name
    private_class_method def self.say_hello(name)
                           "hello #{name}"
                         end
  end

That's not yard-junk's bug, but YARD's: lsegal/yard#1162

(Most of the time, what yard-junk do, is uses YARD's internally to see how it will "understand" your code, and representing its problems and errors in more friendly way.)

I took a look at the yard output but could not find the warning there. This is why I assumed it was a bug local to yard-junk and not yard. Thanks for clearing that up for me.