rubocop-socketry 0.1.3 → 0.2.0
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 +14 -11
- 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: 703167377c5947f3c290afdce02b498de3287c05457714f7025e84719069e457
|
4
|
+
data.tar.gz: aa33490e887990aa87c9f420ba5fede419151530b914a71760a54aba0e4375db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82ef9bb8c77df77e6ba4dfd4af7429cc16ee7ff1993fcdf7b04d20b22b992dbcde2c16b2d28ea28d2e1cce431ce0ec9c22dc222c884d83f03fa0e67b09d44877
|
7
|
+
data.tar.gz: a35703890431c38cbe64514cd616b4c755138fe4ffedc90383d5addcb21a5fa36799435733fb0503fefa1a8d4b41b19ec7761542a68d90ef9cb9ce9daf0a4d46
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -52,7 +52,7 @@ module RuboCop
|
|
52
52
|
|
53
53
|
processed_source.lines.each_with_index do |line, index|
|
54
54
|
line_number = index + 1
|
55
|
-
|
55
|
+
|
56
56
|
unless delta = indentation_deltas[line_number]
|
57
57
|
# Skip this line (e.g., non-squiggly heredoc content):
|
58
58
|
next
|
@@ -97,23 +97,26 @@ module RuboCop
|
|
97
97
|
return unless node.is_a?(Parser::AST::Node)
|
98
98
|
|
99
99
|
case node.type
|
100
|
-
when :block, :hash, :array, :class, :module, :sclass, :def, :defs, :
|
100
|
+
when :block, :hash, :array, :class, :module, :sclass, :def, :defs, :case, :while, :until, :for, :kwbegin
|
101
|
+
|
101
102
|
if location = node.location
|
102
103
|
deltas[location.line] += 1
|
103
104
|
deltas[location.last_line] -= 1
|
104
105
|
end
|
106
|
+
when :if
|
107
|
+
# We don't want to add deltas for elsif, because it's handled by the if node:
|
108
|
+
if node.keyword == "if"
|
109
|
+
if location = node.location
|
110
|
+
deltas[location.line] += 1
|
111
|
+
deltas[location.last_line] -= 1
|
112
|
+
end
|
113
|
+
end
|
105
114
|
when :dstr
|
106
115
|
if location = node.location
|
107
116
|
if location.is_a?(Parser::Source::Map::Heredoc) and body = location.heredoc_body
|
108
|
-
|
109
|
-
|
110
|
-
deltas[
|
111
|
-
deltas[body.last_line] -= 1
|
112
|
-
else
|
113
|
-
# Non-squiggly heredoc - ignore indentation on these lines
|
114
|
-
(body.line..body.last_line).each do |line|
|
115
|
-
deltas[line] = nil
|
116
|
-
end
|
117
|
+
# Don't touch the indentation of heredoc bodies:
|
118
|
+
(body.line..body.last_line).each do |line|
|
119
|
+
deltas[line] = nil
|
117
120
|
end
|
118
121
|
end
|
119
122
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|