AaronC81 / sord

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

Ability to exclude untyped methods #142

Closed wagenet closed 2 years ago

AaronC81 commented 2 years ago

This is a great change to have, thank you!

I think it would be good to also have a test for this. You can add this if you like, but I'm also happy to add a test if you don't get a chance - just let me know :)

wagenet commented 2 years ago

I'll try to see if I can add one tomorrow.

wagenet commented 2 years ago

@AaronC81 obviously I didn't get to adding one yet! I can probably do it next week if you don't get to it sooner.

AaronC81 commented 2 years ago

No worries @wagenet! I've added a test, and also fixed an issue I found while adding it.

In Parlour, comments need to be associated with a "typed object" (e.g. method, class, etc), but here we're explicitly not generating a method if it's untyped. So the "excluding untyped" log message would never be added as a comment like other log messages are, unless some other typed method definition followed.

I've added a wonky workaround by generating these particular comments themselves as typed objects. Seems to work alright!

Feel free to leave any comments about the code I've added, otherwise I'll merge it in a few days :)

AaronC81 commented 2 years ago

Indeed - never a fan of a hack, but I think fixing this in a "proper" way would need some rather complex additions to Parlour. I doubt comments not associated with a typed object are a particularly common use-case anyway.

I'll get this merged then - cheers for taking a look :)