Skip to content

Make translation of each kind of T assertions optional #771

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

Merged
merged 3 commits into from
Jun 19, 2025

Conversation

Morriar
Copy link
Collaborator

@Morriar Morriar commented Jun 18, 2025

By default we translate everything.

It can be enabled/disabled separately:

$ spoom srb assertions translate --translate-t-let --no-translate-t-must --no-translate-t-cast --no-translate-t-bind --no-translate-t-unsafe

@Morriar Morriar self-assigned this Jun 18, 2025
@Morriar Morriar requested a review from a team as a code owner June 18, 2025 22:11
@Morriar Morriar added the feature New feature label Jun 18, 2025
@@ -120,12 +147,16 @@ def t_annotation?(node)
return false unless t?(node.receiver)

case node.name
when :let, :cast
return node.arguments&.arguments&.size == 2
when :let
Copy link
Member

Choose a reason for hiding this comment

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

It feels a little odd to have these options checks as part of this method. This method intuitively checks if something is an annotation. The fact that the translate option is turned off doesn't make the thing not be an annotation anymore.

Would it require too much work to move this out? Or maybe we could have another method that calls this one called should_translate?. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The thing is I don't want to check twice on the name of the send.

I renamed the method translatable_annotation? instead.

Morriar added 3 commits June 19, 2025 11:19
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar force-pushed the at-rbs-annotations-options branch from ee3878a to 30c667b Compare June 19, 2025 15:19
@Morriar Morriar requested a review from vinistock June 19, 2025 15:20
@Morriar Morriar merged commit feee1ac into main Jun 19, 2025
8 checks passed
@Morriar Morriar deleted the at-rbs-annotations-options branch June 19, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants