Closed euglena1215 closed 7 months ago
Just a note that there's no explicit support for sorbet in packwerk. It "just works" since sorbet signatures are just Ruby code and use constant references. It's a lucky coincidence.
So there's no pre-existing method interface parsing mechanism that we can just add YARD to.
I do agree though that YARD support would be useful.
There are some efforts underway to allow for client configured parsers: https://github.com/Shopify/packwerk/pull/375
This would permit a plugin to parse classes declared in YARD comments.
Besides that though I agree it'd make sense to permit YARD comments to be parsed this way (regardless if it's implemented in packwerk itself or as a community maintained plugin in packwerk-extensions)!
Thank you for the information!
There are some efforts underway to allow for client configured parsers: https://github.com/Shopify/packwerk/pull/375
I look forward to waiting for that PR to be merged.
I will try to create a packwerk-yard gem with https://github.com/richardmarbach/packwerk-haml as a reference.
I am creating https://github.com/euglena1215/packwerk-yard.
I found something in the original pull request that needs to be fixed in the process of making it, so I commented on it. https://github.com/Shopify/packwerk/pull/375#issuecomment-1879508382
Thank you for the issue but we have no interest in parsing YARD in this tool.
Suggestion
Support YARD as well as Sorbet as a method interface.
Details
I expect the following behavior.
As shown above, if a comment is placed in the
bar
method that can be interpreted as YARD to theFoo
class, then theFoo
class is handled as dependent on theBar
class.Motivation
In our Rails application we use packwerk and use YARD to define types instead of sorbet. (To be more precise, we use the sord gem to generate RBS from YARD to utilize type information in our editor and IDE).
I understand that you are recommending the use of Sorbet. However, if you support YARD, we can use packwerk more effectively. I also expect that there are many Rails applications out there that do not use Sorbet, but use YARD. I think YARD support will lower the barrier to using packwerk.