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
Check duplicates between shims and Sorbet's RBI payload #879
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Morriar
changed the title
Group check rbi payload
Check duplicates between shims and Sorbet's RBI payload
Apr 1, 2022
Morriar
force-pushed
the
group-check-rbi-payload
branch
2 times, most recently
from
April 1, 2022 15:24
7dcecf8
to
33d04d9
Compare
Morriar
commented
Apr 1, 2022
Comment on lines
-4
to
-5
sig { returns(T::Boolean) } | ||
def default_gem?; end |
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.
Found by the feature itself: https://github.com/sorbet/sorbet/blob/master/rbi/stdlib/bundler.rbi#L9957-L9958
KaanOzkan
approved these changes
Apr 1, 2022
vinistock
approved these changes
Apr 1, 2022
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.
Very nice!
paracycle
reviewed
Apr 5, 2022
Morriar
force-pushed
the
group-check-rbi-payload
branch
2 times, most recently
from
April 5, 2022 22:46
6342c0d
to
30f8376
Compare
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com> Co-authored-by: Kaan Ozkan <kaan.ozkan@shopify.com> Co-authored-by: Vinicius Stock <vinicius.stock@shopify.com>
Extracted in this commit to avoid a bigger, harder to read change in the next one. No functional change here. 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>
Dumping, parsing and indexing Sorbet's payload takes around ~5s. We don't need to waste this time in most tests here. Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
This definition is duplicated from https://github.com/sorbet/sorbet/blob/master/rbi/stdlib/bundler.rbi#L9958. Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Morriar
force-pushed
the
group-check-rbi-payload
branch
from
April 5, 2022 22:53
30f8376
to
91dcde9
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Check duplicates between shims files and Sorbet's payload.
It's frequent that we locally fix Sorbet's payload in our shims waiting for the same patch to be merged upstream. The problem is that after a while we forget the local fixes and they stay there for ever. This can even become dangerous when the definition in the payload is later updated and we keep the shadowing local definition.
This PR introduces a way to check for duplicates between the local shims and Sorbet's payload.
Implementation
This feature uses Sorbet's
--print=payload_sources
to dump the RBIs from its payload so we can index them in the same way we do for gems RBIs and DSL RBIs.I gated the feature behind a specific Sorbet version like we did for
to_ary_nil_support
.Tests
See automated tests.