lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.92k stars 396 forks source link

Methods from other classes/modules appear where they don't belong #343

Closed thomthom closed 13 years ago

thomthom commented 13 years ago

I'm getting some method documentation that doesn't list in the correct namespace.

I have a project which root module is at TT::Plugins::BezierSurfaceTools

This module has four method - all of which are documented correctly.

But I'm seeing a method from TT::Plugins::BezierSurfaceTools::BezierEdge#end= being listed as a method for TT::Plugins::BezierSurfaceTools.

The method #end= which belong to class TT::Plugins::BezierSurfaceTools::BezierEdge is even defined in a separate file. None of the other methods from BezierEdge is cross-documented like this.

I'm using Yard 0.7.1 under Windows 7 64bit.

Screenshot: http://img215.imageshack.us/img215/8049/yarderror.png

lsegal commented 13 years ago

Do you have the code that reproduces this issue somewhere? Or can you create a minimal case that reproduces the issue if you can't post the code?

thomthom commented 13 years ago

Not publicly no - the sourcecode is for a commercial SketchUp plugin I'm developing. I can privately send you the source code for inspection if you want.

thomthom commented 13 years ago

Also - the Top Level Namespace page also lists method from multiple classes/modules and files.

thomthom commented 13 years ago

And now I see that all the stray method comes from BezierEdge - which only document a few of the methods correctly. I don't see any difference in this class/file compared to my other files/modules/classes.

lsegal commented 13 years ago

If you can create a minimal test case that reproduces the issue that would be helpful. Otherwise email the code to lsegal@soen.ca and I will check it out tomorrow.

lsegal commented 13 years ago

Also what version of ruby are you using? (ruby -v)

thomthom commented 13 years ago

I'm using 1.8.6 (don't know the exact build number at the moment as I'm not at my development machine.) I'm using this version because it is what SketchUp bundle and I use it to build C Extensions for Google SketchUp.

I haven't been able to reproduce it in an isolated case. I've looked over the code time and again, but I can't work out any deviance from my other code that works fine.

koraktor commented 13 years ago

Did you cleanup your .yardoc directory? I encountered similar problems when running yard server and the .yardoc directory became somewhat corrupted.

thomthom commented 13 years ago

I did a complete regeneration yesterday - just in case there was an issue there. But there was no difference.

I have not been running yard as a server btw.

lsegal commented 13 years ago

Thanks for sending the code, I've managed to reproduce this.

module A
  class B
    def b; end

    def end
    end

    def foo; end
    def bar; end
  end
end

The "def end" is confusing the parser. FWIW this is only an issue with the legacy parser, so a temporary workaround (until 0.7.2 is released) would be to use Ruby 1.9.2 to generate docs.

thomthom commented 13 years ago

Ahh! So that's why. I could not for the love of my sanity work out why it failed. Thank you for looking into this. Good work.