-
Notifications
You must be signed in to change notification settings - Fork 138
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
Filter gem RBIs by version during annotations
command
#1585
Conversation
0635c79
to
b21d9bd
Compare
annotations
commandannotations
command
b21d9bd
to
ca863df
Compare
d8ed7fe
to
0ccc549
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few inline comments, but additionally:
Is this still a "Proof of concept"? I think once we merge this, it will ship in the next release, right?
0ccc549
to
b7f4fe5
Compare
annotations
commandannotations
command
b7f4fe5
to
690e6ad
Compare
690e6ad
to
9a3bcc5
Compare
@@ -12,6 +12,7 @@ class AnnotationsTest < SpecWithProject | |||
|
|||
after do | |||
@project.remove!("sorbet/rbi/annotations") | |||
@project.write!("Gemfile", @project.tapioca_gemfile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary to prevent leaking Gemfile changes between tests
The `GemInfo` class is a wrapper around a gem name and verison. This will make it easier to pass a gem version around, allowing us to filter RBI annotations by version.
9a3bcc5
to
ece4a72
Compare
Motivation
This PR aims to solve the problem of versioning RBIs. Up until now, there is no default way to write RBI for different versions of the same gem. This can lead to confusing issues for Sorbet users where RBIs don't match the version of a gem they're using, and they have to spend time figuring out whether their gem is out of date, whether the RBI is wrong, or if it's even both! Having a way to specify RBI for multiple versions of the same gem would allow people to adopt and use Sorbet without having to go through this hassle.
Implementation
The actual RBI filtering behavior is implemented in the RBI repo. This uses the
FilterVersions
rewriter during the annotations command to remove parts of the annotation RBI that aren't relevant to a certain gem version.Tests
I have added a test for this functionality.