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

Modify YardDoc listener to create RBS signatures #2218

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

KaanOzkan
Copy link
Contributor

@KaanOzkan KaanOzkan commented Feb 25, 2025

Relies on Shopify/rbi#420

Motivation

This listener is responsible for identifying RBS signatures from method comments exported from gems.

Implementation

Duplicated YARD comment retrieval and then small processing

Tests

Added

Copy link
Collaborator

@Morriar Morriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoudn't we also change the Yard listener to not create a comment?

I'm not sure if we want to have both listeners tbh, maybe just one that create either a RBI::Comment or a RBSSig?

btw, maybe RBI::SigComment would be better? Not sure.

@KaanOzkan
Copy link
Contributor Author

Shoudn't we also change the Yard listener to not create a comment?

I opted for skipping it in RBI::Printer instead. Also we have separation of concerns.

I'm not sure if we want to have both listeners tbh, maybe just one that create either a RBI::Comment or a RBSSig?

YARD listener is doing quite a bit, I like having 2 separate. But it's slower since we go through the comments again. If we want performance we can combine them.

@KaanOzkan KaanOzkan changed the title Introduce RBSSigbnatures listener Modify YardDoc listener to create RBS signatures Feb 25, 2025
@KaanOzkan KaanOzkan requested a review from Morriar February 25, 2025 17:14
Comment on lines 70 to 71
if line.strip.start_with?(RBS_SIGNATURE_PREFIX)
RBI::RBSSig.new(line[1..])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering #: -> void, we already ignore the # fine, we also skip the :, but we should strip the result before passing it to RBSSig.new.

It identifies RBS signatures from method comments exported by gems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants