rubocop-socketry 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cd24ac3f11cf5e4b0fc32f54ca985578963b64ea7ccdf9d148996b75e0df68f
4
- data.tar.gz: 57ca52a7c26e6f4b029b928ad0b6d5cae1dfab8e8c4105ebd084be7fe1a9732b
3
+ metadata.gz: bdf96e461ba72f91f680ae3a68c72b8a3147c3f3643b1ba2ac78b4faa9285ebd
4
+ data.tar.gz: 541814b98f28c0ccb78378c5752df9d1093afd7e41881e7ba18ad804cc1538da
5
5
  SHA512:
6
- metadata.gz: '059d5dd3fc0e62510c4966ea018c4ef15d4e8fd54827895441899c47ca38a4d408e9ef39795112f2c913f0af9012172a0339c3ac42de58f1273ca77e4762161a'
7
- data.tar.gz: dd8b19f094ace1a5891d14877331d9eda98e45a08e326b2d1b87e96696987067bd369852d2887a4e4d4a1c63c38f549ed2d4e07899607da04e373ae924682465
6
+ metadata.gz: dd942adb6f5fa81ec37d5e3898c2dc736d4a9f9d2530d8f3e08fbfde11decec5cc9f81b40525d8a16370f98de48ad254fa3a20a505dd8e008413154fbe324a00
7
+ data.tar.gz: 2d33e2859470e2a66df2d58b0b5ced439de091b1d11b14261864f7f0f97d9726a75fa693d066d8ba4bdd51b5c63c808bef8af74fce6e86554436e7fec37e052a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -89,20 +89,9 @@ module RuboCop
89
89
  deltas
90
90
  end
91
91
 
92
- def receiver_handles_indentation(node)
93
- if send_node = node.children.first
94
- return false unless send_node.type == :send
95
-
96
- if receiver = send_node.children.first
97
- # Only structural node types handle their own indentation.
98
- # These are nodes that create indentation contexts (arrays, hashes, classes, etc.)
99
- # All other receivers (simple references, method calls, literals) should allow block indentation.
100
- return [:array, :hash, :class, :module, :sclass, :def, :defs, :if, :while, :until, :for, :case, :kwbegin].include?(receiver.type)
101
- end
102
- end
103
-
104
- return false
105
- end # Recursively walk the AST to build indentation deltas for block structures.
92
+ STRUCTURAL_NODES = [:array, :hash, :class, :module, :sclass, :def, :defs, :if, :if, :while, :until, :for, :case, :kwbegin]
93
+
94
+ # Recursively walk the AST to build indentation deltas for block structures.
106
95
  # This method identifies nodes that should affect indentation and records the deltas.
107
96
  # @parameter node [Parser::AST::Node] The current AST node to process.
108
97
  # @parameter deltas [Hash(Integer, Integer)] The deltas hash to populate.
@@ -112,21 +101,16 @@ module RuboCop
112
101
 
113
102
  case node.type
114
103
  when :block
115
- # For blocks, we need to be careful about method receiver collections
104
+ # For blocks, use the actual block begin/end boundaries, not the full location
116
105
  if location = node.location
117
- unless receiver_handles_indentation(node)
118
- deltas[location.line] += 1
119
- deltas[location.last_line] -= 1
106
+ if location.begin && location.end
107
+ deltas[location.begin.line] += 1
108
+ deltas[location.end.line] -= 1
120
109
  end
121
110
  end
122
- when :array, :hash, :class, :module, :sclass, :def, :defs, :while, :until, :for, :case, :kwbegin
123
- if location = node.location
124
- deltas[location.line] += 1
125
- deltas[location.last_line] -= 1
126
- end
127
111
  when :if
128
112
  # We don't want to add deltas for elsif, because it's handled by the if node:
129
- if node.keyword == "if"
113
+ if node.keyword == "if" || node.keyword == "unless"
130
114
  if location = node.location
131
115
  deltas[location.line] += 1
132
116
  deltas[location.last_line] -= 1
@@ -141,6 +125,11 @@ module RuboCop
141
125
  end
142
126
  end
143
127
  end
128
+ when *STRUCTURAL_NODES
129
+ if location = node.location
130
+ deltas[location.line] += 1
131
+ deltas[location.last_line] -= 1
132
+ end
144
133
  end
145
134
 
146
135
  node.children.each do |child|
@@ -5,6 +5,6 @@
5
5
 
6
6
  module RuboCop
7
7
  module Socketry
8
- VERSION = "0.2.2"
8
+ VERSION = "0.2.4"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-socketry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file