rubocop-socketry 0.2.1 → 0.2.3
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rubocop/socketry/layout/consistent_blank_line_indentation.rb +12 -7
- data/lib/rubocop/socketry/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b25ad4b5bdd6aeaf9f0b41a518f8c31db3ead2ab410f837827f2bc92d422954b
|
4
|
+
data.tar.gz: b405f44e0c5e435864b035fd24ff5bf56cfa9dc75b7f920b05db906856791f32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ebc654b95f9ff26fc351afc98a9b2250501b05b3a03e882d27c5a2deb689d986f9619f95f520ea1a1a38c638311b90351b1478339f03d0e14a087180f9dd482
|
7
|
+
data.tar.gz: 8a21062e6208ea01b33727343930a50aa7be89d1bf83eaaeb8eb741ac9f4148a46e51b788e0af3360480ca648b2ff012d51d56e9fafcc997bbb336129a8b422f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -89,12 +89,17 @@ module RuboCop
|
|
89
89
|
deltas
|
90
90
|
end
|
91
91
|
|
92
|
+
STRUCTURAL_NODES = [:array, :hash, :class, :module, :sclass, :def, :defs, :if, :while, :until, :for, :case, :kwbegin]
|
93
|
+
|
92
94
|
def receiver_handles_indentation(node)
|
93
95
|
if send_node = node.children.first
|
94
96
|
return false unless send_node.type == :send
|
95
97
|
|
96
98
|
if receiver = send_node.children.first
|
97
|
-
|
99
|
+
# Only structural node types handle their own indentation.
|
100
|
+
# These are nodes that create indentation contexts (arrays, hashes, classes, etc.)
|
101
|
+
# All other receivers (simple references, method calls, literals) should allow block indentation.
|
102
|
+
return STRUCTURAL_NODES.include?(receiver.type)
|
98
103
|
end
|
99
104
|
end
|
100
105
|
|
@@ -118,14 +123,9 @@ module RuboCop
|
|
118
123
|
deltas[location.last_line] -= 1
|
119
124
|
end
|
120
125
|
end
|
121
|
-
when :hash, :array, :class, :module, :sclass, :def, :defs, :case, :while, :until, :for, :kwbegin
|
122
|
-
if location = node.location
|
123
|
-
deltas[location.line] += 1
|
124
|
-
deltas[location.last_line] -= 1
|
125
|
-
end
|
126
126
|
when :if
|
127
127
|
# We don't want to add deltas for elsif, because it's handled by the if node:
|
128
|
-
if node.keyword == "if"
|
128
|
+
if node.keyword == "if" || node.keyword == "unless"
|
129
129
|
if location = node.location
|
130
130
|
deltas[location.line] += 1
|
131
131
|
deltas[location.last_line] -= 1
|
@@ -140,6 +140,11 @@ module RuboCop
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
143
|
+
when *STRUCTURAL_NODES
|
144
|
+
if location = node.location
|
145
|
+
deltas[location.line] += 1
|
146
|
+
deltas[location.last_line] -= 1
|
147
|
+
end
|
143
148
|
end
|
144
149
|
|
145
150
|
node.children.each do |child|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|