I'm quite interested in using this once it becomes stable and is merged into RBS/steep proper. I haven't tried it yet, but one concern I had was about the end-of-line comment syntax:
some_expression #: [RBS type]
My concern is that this syntax does not appear to pass the comment style enforced by common Ruby linters like standardrb. Standard enablesLayout/LeadingCommentSpace which would consider that a lint violation, requiring it to instead be written as:
some_expression # : [RBS type]
Can rbs-inline support both? I was curious if it already does and it looks like it doesn't. I applied this patch locally:
diff --git a/test/rbs/inline/writer_test.rb b/test/rbs/inline/writer_test.rb
index ae12f5a..cdcc3cd 100644
--- a/test/rbs/inline/writer_test.rb
+++ b/test/rbs/inline/writer_test.rb
@@ -130,7 +130,7 @@ class RBS::Inline::WriterTest < Minitest::Test
end
def hoge x,
- y #: Integer
+ y # : Integer
end
end
RUBY
@@ -465,7 +465,7 @@ class RBS::Inline::WriterTest < Minitest::Test
output = translate(<<~RUBY)
VERSION = "hogehoge"
- SIZE = [123] #: Array[Integer]
+ SIZE = [123] # : Array[Integer]
NAMES = __dir__
@@ -511,7 +511,7 @@ class RBS::Inline::WriterTest < Minitest::Test
module Foo
# @rbs @foo: String -- This is something
- def foo #: void
+ def foo # : void
end
# @rbs self.@foo: Integer -- Something another
@@ -731,7 +731,7 @@ class RBS::Inline::WriterTest < Minitest::Test
module M
# @rbs module ClassMethods[A] : BasicObject
class_methods do
- def foo #: Integer
+ def foo # : Integer
123
end
end
I'm quite interested in using this once it becomes stable and is merged into RBS/steep proper. I haven't tried it yet, but one concern I had was about the end-of-line comment syntax:
My concern is that this syntax does not appear to pass the comment style enforced by common Ruby linters like standardrb. Standard enables Layout/LeadingCommentSpace which would consider that a lint violation, requiring it to instead be written as:
Can rbs-inline support both? I was curious if it already does and it looks like it doesn't. I applied this patch locally:
When I ran the tests I got failures: