AaronC81 / sord

Convert YARD docs to Sorbet RBI and Ruby 3/Steep RBS files
https://sord.aaronc.cc
MIT License
299 stars 18 forks source link

Question: Are warns for constants coming from gems normal? #126

Closed trashhalo closed 3 years ago

trashhalo commented 3 years ago
# @return [Array<Async::Task>]
def feed_to_futures(feed, ignore)

I have something like the above. Async::Task is coming from the 'async' gem. Running sord on this its angry:

[WARN ] (LinkController#feed_to_futures) Async::Task wasn't able to be resolved to a constant in this project

I've been digging around in the source and the yard docs and it seems to use the yard registry to resolve constants. As far as I can tell the yard registry is only aware of constants within your project. I haven't figured out how to make it aware of constants from your gem files. I also tried explicitly requiring the async gem but it didn't seem to help.

Am I doing something wrong here???

AaronC81 commented 3 years ago

This is entirely normal for classes from gems - YARD can't see them, so neither can Sord.

Since any type checker you run later on should be able to resolve these types from gems itself, you can typically just ignore these warnings!

There isn't currently a way of letting Sord know about these classes, although I can definitely see how that'd be useful.