rubocop-sorbet 0.7.2 → 0.7.3

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: 1055d638bfa57be52838a060db6bbf9d4dd717d121d305ff40823c96bcca08dd
4
- data.tar.gz: 26eac2df2b9e99687258a236e9b9e35c41f48f83b7cacb1549f3dd4c355c6a2b
3
+ metadata.gz: a0c73cc4c4d3b4982d210699da94d0dca321a93bf95e98579dc32521714e2921
4
+ data.tar.gz: b9aa475dea9aa87511868680e92fb1ad5dff83a5b8186439179c17371eaf35f5
5
5
  SHA512:
6
- metadata.gz: a136684c7ce1a5670f2d646ee9aa91c56eee03ff3cec7901ba1358d9d13eb907de33e4864019233a1278956d8896cf74d2697159b88be0bb0af7f72db1910eca
7
- data.tar.gz: 7a45a12236bb6353b8dc5c5425df5c5de8ed8ba070a350384898c606bfffbb79899f460c3c941d8b4cf291c84e62a7d1a3fc3a6f82549c5133f7c01a372a24cd
6
+ metadata.gz: 03a722e469cf1796ba965b044475dabbbe2d99a6b0b79efc083d605bd8dd0973ed1d320dbe511241dd6bfad3c9df7acb6354217ded268db5939ad7f8bf7684aa
7
+ data.tar.gz: 9fd995f27b0881e5ec939da2b0b1a87372bc910faa4f27cbaf0de43c367d877e1c5b077397f80130ec58f1caa7b6047a7c51ea1eb0872f194f118ce27dbfa10d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubocop-sorbet (0.7.2)
4
+ rubocop-sorbet (0.7.3)
5
5
  rubocop (>= 0.90.0)
6
6
 
7
7
  GEM
@@ -23,25 +23,53 @@ module RuboCop
23
23
  "Instead, strive to write interfaces which respect subtyping principles and remove `allow_incompatible`"
24
24
  RESTRICT_ON_SEND = [:override].freeze
25
25
 
26
- # @!method allow_incompatible_override?(node)
27
- def_node_matcher(:allow_incompatible_override?, <<~PATTERN)
26
+ # @!method sig_dot_override?(node)
27
+ def_node_matcher(:sig_dot_override?, <<~PATTERN)
28
28
  (send
29
- #sig?
29
+ [!nil? #sig?]
30
30
  :override
31
31
  (hash <$(pair (sym :allow_incompatible) true) ...>)
32
32
  )
33
33
  PATTERN
34
34
 
35
35
  # @!method sig?(node)
36
- def_node_search :sig?, <<~PATTERN
36
+ def_node_search(:sig?, <<~PATTERN)
37
37
  (send _ :sig ...)
38
38
  PATTERN
39
39
 
40
+ # @!method override?(node)
41
+ def_node_matcher(:override?, <<~PATTERN)
42
+ (send
43
+ _
44
+ :override
45
+ (hash <$(pair (sym :allow_incompatible) true) ...>)
46
+ )
47
+ PATTERN
48
+
40
49
  def on_send(node)
41
- allow_incompatible_override?(node) do |allow_incompatible_pair|
50
+ sig_dot_override?(node) do |allow_incompatible_pair|
42
51
  add_offense(allow_incompatible_pair)
43
52
  end
44
53
  end
54
+
55
+ def on_block(node)
56
+ return unless sig?(node.send_node)
57
+
58
+ block = node.children.last
59
+ return unless block.send_type?
60
+
61
+ receiver = block.receiver
62
+ while receiver
63
+ allow_incompatible_pair = override?(receiver)
64
+ if allow_incompatible_pair
65
+ add_offense(allow_incompatible_pair)
66
+ break
67
+ end
68
+ receiver = receiver.receiver
69
+ end
70
+ end
71
+
72
+ alias_method :on_numblock, :on_block
45
73
  end
46
74
  end
47
75
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Sorbet
5
- VERSION = "0.7.2"
5
+ VERSION = "0.7.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-sorbet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ufuk Kayserilioglu
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2023-08-07 00:00:00.000000000 Z
14
+ date: 2023-08-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
- rubygems_version: 3.4.17
155
+ rubygems_version: 3.4.18
156
156
  signing_key:
157
157
  specification_version: 4
158
158
  summary: Automatic Sorbet code style checking tool.