Consider the following workflow:
'first_gem')srb init and commit sorbet/ folderGemfile ('second_gem') and run bundle installsrb rbi gemsMy expectation, upon running srb rbi gems is that the diff would include exactly one added file, sorbet/rbi/gems/second_gem.rbi
However, srb rbi gems _also_ seems to modify the # typed: annotation in the first gem's RBI file, sorbet/rbi/gems/first_gem.rbi
I set up an example repository with a branch init-rbi-gems-issue that replicates these steps exactly (first gem: 'colored', second gem: 'timecop') in a series of commits: example repository
Specifically, you can see the modification of the original gem in the final commit.
srb rbi gems modifies # typed: annotation level on gem RBIs created via srb init
srb rbi gems should only modify gem RBIs for newly added gems or gems with changed source code (e.g. on gem version changes)
I observed the same behavior with my own project 馃憤
Thank you for the very specific bug report! It was incredibly helpful.
In case the repo gets deleted, here's the interesting diff:
diff --git a/sorbet/rbi/gems/colored.rbi b/sorbet/rbi/gems/colored.rbi
index fe60be2..0c8631d 100644
--- a/sorbet/rbi/gems/colored.rbi
+++ b/sorbet/rbi/gems/colored.rbi
@@ -1,7 +1,7 @@
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
# srb rbi gems
-# typed: strong
+# typed: true
#
# If you would like to make changes to this file, great! Please create the gem's shim here:
#
The problem is that srb init actually has two steps which change the files in the sorbet/rbi/gems folder:
gems subcommand, which creates the RBIssuggest-typed subcommand, which puts the highest strictness level into each file in a project as it can without introducing errorsSo the workaround would be to run
srb rbi gems && srb rbi suggest-typed
but we could also make this the default behavior. I'm marking as a good first issue in case someone wants to implement this.
Saw this today too.
Most helpful comment
Thank you for the very specific bug report! It was incredibly helpful.
In case the repo gets deleted, here's the interesting diff:
The problem is that
srb initactually has two steps which change the files in thesorbet/rbi/gemsfolder:gemssubcommand, which creates the RBIssuggest-typedsubcommand, which puts the highest strictness level into each file in a project as it can without introducing errorsSo the workaround would be to run
but we could also make this the default behavior. I'm marking as a good first issue in case someone wants to implement this.