Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MixinHandler erroneously attaching module to root namespace #1386

Closed
dduugg opened this issue Jun 1, 2021 · 0 comments
Closed

MixinHandler erroneously attaching module to root namespace #1386

dduugg opened this issue Jun 1, 2021 · 0 comments
Labels

Comments

@dduugg
Copy link
Contributor

dduugg commented Jun 1, 2021

Hi, I have a yard plugin, wherein one module is included in another, like so:

YARD::Handlers::Ruby::ClassHandler.include YARDSorbet::StructClassHandler

(this may be a suboptimal design, feedback welcome.)

This should register YARDSorbet::StructClassHandler's methods under the YARD::Handlers::Ruby::ClassHandler namespace. Instead, what I'm finding is that the methods are instead registered on the top-level namespace.

Poking around a bit, I think there might be an unhandled case in YARD::Handlers::Ruby::MixinHandler#recipient, where if statement[0].type is a :const_path_ref, the recipient should be a code object representing statement[0], instead of the current namespace.

Let me know if that sounds right, and if you have any advice for resolution (I realize I can open up the class to resolve this specific case, but it still produces erroneous output for non-DSL usage).

Update: I've written a workaround, so this is no longer visible in the online documentation, but can be repro'd by checking out at 209737c and running rake yard.

Thanks!

Steps to reproduce

git clone https://github.com/dduugg/yard-sorbet.git
cd yard-sorbet
bundle exec yard doc

Environment details:

  • OS: [Enter operating system / version here]
  • Ruby version (ruby -v): 2.7.2
  • YARD version (yard -v): 0.9.26
  • Relevant software dependency/versions:
    • [Any 3rd party libs required to reproduce, omit if none]

I have read the Contributing Guide.

@lsegal lsegal added the Bug label Sep 5, 2021
@lsegal lsegal closed this as completed in cbd40ea Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants