rbi 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc6e4bca77c6143bf821b712db2dd8b5bb24ce1cf039c35cf9c1cef2eecb438e
4
- data.tar.gz: 224672f4a192a102f01b5d8903ea771fbd26cc4fe3c0519120bd3597cb31d45f
3
+ metadata.gz: 3705c571d4b2685e60fec1c0dc54435caed79ba988239006be0bf14757790c51
4
+ data.tar.gz: 4560dc122385781dd604cdc4ca57835caa22e3f29b2cafa5b7e2e468032c5923
5
5
  SHA512:
6
- metadata.gz: 6b98fab6fd4a4efab9f443d54cc974f1814f3a1895e6dfadf1e42c8cbc22af582c6f36a5e540f466efd5b5dc678568165e4d46b349f06ff75a2b01ba51408d1c
7
- data.tar.gz: 07ab68691a289c8a4733a7dcd85e9505313646ce9291448df9fbf820743606916e8f878f5e6b9903e9182f5dfdb99a18264b82b206c846bf1b6a5d2069406444
6
+ metadata.gz: 3f70d57182bed826c64ca53ed2d62a1da0aeb0dee1badbe774ed00c8bd505b8e40f00363c4ca069efef457649cff19ce6b2be595e6dca453e56456eb4580ca38
7
+ data.tar.gz: 5c60fedeeb8995f9e6ed4ef926f68870ed88021de20e60294e1aec97029c728f24d098a8d297ec967dbfc23c31788dbb30d82b8f925f1c95962df7772580c294
data/Gemfile CHANGED
@@ -10,7 +10,7 @@ group(:development, :test) do
10
10
  gem("minitest")
11
11
  gem("minitest-reporters")
12
12
  gem("rake", "~> 13.2")
13
- gem("rubocop", "~> 1.63", require: false)
13
+ gem("rubocop", "~> 1.65", require: false)
14
14
  gem("rubocop-shopify", require: false)
15
15
  gem("rubocop-sorbet", require: false)
16
16
  gem("sorbet", ">= 0.5.9204", require: false)
data/lib/rbi/formatter.rb CHANGED
@@ -8,18 +8,6 @@ module RBI
8
8
  sig { params(sort_nodes: T::Boolean).returns(T::Boolean) }
9
9
  attr_writer :sort_nodes
10
10
 
11
- sig { params(nest_singleton_methods: T::Boolean).returns(T::Boolean) }
12
- attr_writer :nest_singleton_methods
13
-
14
- sig { params(add_sig_templates: T::Boolean).returns(T::Boolean) }
15
- attr_writer :add_sig_templates
16
-
17
- sig { params(group_nodes: T::Boolean).returns(T::Boolean) }
18
- attr_writer :group_nodes
19
-
20
- sig { params(nest_non_public_methods: T::Boolean).returns(T::Boolean) }
21
- attr_writer :nest_non_public_methods
22
-
23
11
  sig { returns(T.nilable(Integer)) }
24
12
  attr_accessor :max_line_length
25
13
 
data/lib/rbi/index.rb CHANGED
@@ -19,7 +19,7 @@ module RBI
19
19
 
20
20
  sig { void }
21
21
  def initialize
22
- super()
22
+ super
23
23
  @index = T.let({}, T::Hash[String, T::Array[Node]])
24
24
  end
25
25
 
data/lib/rbi/model.rb CHANGED
@@ -2,6 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module RBI
5
+ class ReplaceNodeError < Error; end
6
+
5
7
  class Node
6
8
  extend T::Sig
7
9
  extend T::Helpers
@@ -32,10 +34,10 @@ module RBI
32
34
  sig { params(node: Node).void }
33
35
  def replace(node)
34
36
  tree = parent_tree
35
- raise unless tree
37
+ raise ReplaceNodeError, "Can't replace #{self} without a parent tree" unless tree
36
38
 
37
39
  index = tree.nodes.index(self)
38
- raise unless index
40
+ raise ReplaceNodeError, "Can't find #{self} in #{tree} child nodes" unless index
39
41
 
40
42
  tree.nodes[index] = node
41
43
  node.parent_tree = tree
data/lib/rbi/parser.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  require "prism"
5
5
 
6
6
  module RBI
7
- class ParseError < StandardError
7
+ class ParseError < Error
8
8
  extend T::Sig
9
9
 
10
10
  sig { returns(Loc) }
@@ -17,7 +17,7 @@ module RBI
17
17
  end
18
18
  end
19
19
 
20
- class UnexpectedParserError < StandardError
20
+ class UnexpectedParserError < Error
21
21
  extend T::Sig
22
22
 
23
23
  sig { returns(Loc) }
@@ -719,7 +719,7 @@ module RBI
719
719
  comments = node_comments(send)
720
720
  default_value = T.let(nil, T.nilable(String))
721
721
 
722
- rest&.each do |arg|
722
+ rest.each do |arg|
723
723
  next unless arg.is_a?(Prism::KeywordHashNode)
724
724
 
725
725
  arg.elements.each do |assoc|