yard icon indicating copy to clipboard operation
yard copied to clipboard

Undocumented codebase with own Object class outputs wrong return value

Open lulalala opened this issue 3 years ago • 1 comments

For undocumented gems, YARD would default the return value as Object. However, when the lib contains its own namespaced Object class, and return value would be linked to that incorrect Object class.

Steps to reproduce

This is the minimal reproduction for the issue. I've done my best to remove all extraneous code and unique environment state on my machine before providing these steps:

  1. Visit https://www.rubydoc.info/gems/iron_bank/3.1.1/IronBank/Queryable:find

Actual Output

Return value "Object" links to IronBank::Object page

Expected Output

Return value "Object" should not be linked, since it should point to Ruby's native Object.

Environment details:

  • OS: Mac OS X
  • Ruby version (ruby -v): 2.6.6
  • YARD version (yard -v): 0.9.24

I have read the Contributing Guide.

lulalala avatar Jul 08 '20 06:07 lulalala

FWIW, this is easily solved with --default-return ::Object in your .yardopts file. I think for YARD to implement this out of the box it would require some slightly nicer formatting for the overwhelmingly common case.

lsegal avatar Jul 08 '20 06:07 lsegal