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

Add command spoom srb sigs translate to translate RBI signatures into RBS comments #611

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

Morriar
Copy link
Collaborator

@Morriar Morriar commented Oct 3, 2024

Consider the following file.rb:

# typed: strict

class Foo
  sig { returns(String) }
  attr_reader :x

  sig { params(x: String).void }
  def initialize(x)
    @x = x
  end
end

We can translate the RBI signatures it contains using the introduced Spoom command:

$ spoom srb sigs translate file.rb

Wich will update the file contents as follows:

# typed: strict

class Foo
  #: String
  attr_reader :x

  #: (String x) -> void
  def initialize(x)
    @x = x
  end
end

@Morriar Morriar added the feature New feature label Oct 3, 2024
@Morriar Morriar self-assigned this Oct 3, 2024
@Morriar Morriar requested a review from a team as a code owner October 3, 2024 19:08
@Morriar Morriar requested review from amomchilov and egiurleo October 3, 2024 19:08
Copy link
Member

@paracycle paracycle left a 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 suggestions, but they are not essential. This looks good to me!

lib/spoom/sorbet/translate_sigs.rb Outdated Show resolved Hide resolved
lib/spoom/sorbet/translate_sigs.rb Outdated Show resolved Hide resolved
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>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@Morriar Morriar merged commit 9512fb1 into main Dec 18, 2024
8 checks passed
@Morriar Morriar deleted the at-rbi-2-rbs branch December 18, 2024 16:06
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.

3 participants