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

Allow ignoring gem constants #2201

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

gmalette
Copy link

Motivation

In one of our repos we're loading the same gem foo both in a dependency (gem bar), and directly in the host project. This foo gem is then generated with tapioca both as part of sorbet/rbi/gem/[email protected] and [email protected].

The problem lies in that foo signatures that can't be loaded twice by Sorbet, such at type_member and alias.

I've been able to sidestep the problem so far by having typed_overrides -> "ignore" and manually creating annotations for the gem, but the list of constants required grows every day and this is untenable. What I really need is to be able to say "ignore foo as generated in bar". This is what this PR does.

I haven't exposed this to the config.yml file yet

Implementation

This PR is the most bare-bones it can be; I just want to have a starting point for the discussion.

Tests

Basic test to show what I expect it to do.

@gmalette gmalette requested a review from a team as a code owner February 12, 2025 20:57
@gmalette gmalette added the enhancement New feature or request label Feb 12, 2025
@gmalette gmalette changed the title [cookies] Allow ignoring gem constants Allow ignoring gem constants Feb 12, 2025
@paracycle
Copy link
Member

This foo gem is then generated with tapioca both as part of sorbet/rbi/gem/[email protected] and [email protected].

I think we should fix this root problem, instead of adding ignores for namespaces.

If the attribution of methods/constants to gems is wrong, we should fix that.

I actually think #293 might already fix this problem.

@gmalette
Copy link
Author

gmalette commented Feb 13, 2025

I'm not sure #293 would fix it because both sources define the methods, but I'll be honest I don't fully understand how tapioca works

I think we should fix this root problem, instead of adding ignores for namespaces.

Sure... but how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants