yoshiki 11.0.0.pre.11 → 11.0.0.pre.12
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
- data/Gemfile.lock +1 -1
- data/lib/rubocop/cop/yoshiki/style/nested_html_option_keys/rewriter.rb +31 -6
- data/lib/yoshiki/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7880f8dd34e18f32da07f286fdabfecfad92b70f420a0cc11f4a69768b84980d
|
|
4
|
+
data.tar.gz: 6a11267e9a64df75b2708935076400fdb6898ef5872a262ec04edc9ae0971dc8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d458f79d7411fc843cf6bd3518f02a251b1d27a4492323739fd430358391b93fc8d04f00103e7068f00016cea41ff3486db707b5c19ece209872485f9f70d7d8
|
|
7
|
+
data.tar.gz: 328635ca21159c25ed41674d1aac844495168d4ba19306cc28d264d981d292594e578a87d6f037380893d519a21cebf01d2515bf540e8a48353ce41adbe7f438
|
data/Gemfile.lock
CHANGED
|
@@ -18,7 +18,7 @@ module RuboCop
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def changed?
|
|
21
|
-
@forest.
|
|
21
|
+
@forest.mutated? && replacement != @node.source
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def replacement
|
|
@@ -36,10 +36,19 @@ module RuboCop
|
|
|
36
36
|
@prefixes = prefixes
|
|
37
37
|
@direct = []
|
|
38
38
|
@all_offenses = []
|
|
39
|
+
@mutated = false
|
|
39
40
|
@tree = Tree.new(self)
|
|
40
41
|
@entries = build(node, mode_for(node), true)
|
|
41
42
|
end
|
|
42
43
|
|
|
44
|
+
def mutated?
|
|
45
|
+
@mutated
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def mutated!
|
|
49
|
+
@mutated = true
|
|
50
|
+
end
|
|
51
|
+
|
|
43
52
|
def build node, mode, direct
|
|
44
53
|
node.children.each_with_object([]) do |child, entries|
|
|
45
54
|
push(entries, child, mode, direct)
|
|
@@ -129,9 +138,14 @@ module RuboCop
|
|
|
129
138
|
def insert_path entries, path, pair, direct
|
|
130
139
|
@forest.note_offense(pair, direct)
|
|
131
140
|
slot = ensure_branch(entries, path.first)
|
|
132
|
-
|
|
141
|
+
if slot && merge_leaf?(slot[:children], path.drop(1), pair)
|
|
142
|
+
@forest.mutated!
|
|
143
|
+
return
|
|
144
|
+
end
|
|
133
145
|
|
|
134
146
|
entries.delete(slot) if slot && slot[:children].empty?
|
|
147
|
+
return if join_leaf?(entries, path, pair)
|
|
148
|
+
|
|
135
149
|
append(entries, :raw, source: pair.source)
|
|
136
150
|
end
|
|
137
151
|
|
|
@@ -164,11 +178,22 @@ module RuboCop
|
|
|
164
178
|
first, *rest = path
|
|
165
179
|
return add_leaf?(entries, first, pair) if rest.empty?
|
|
166
180
|
|
|
167
|
-
slot = ensure_branch(entries, first)
|
|
168
|
-
|
|
181
|
+
slot = ensure_branch(entries, first)
|
|
182
|
+
if slot
|
|
183
|
+
return true if merge_leaf?(slot[:children], rest, pair)
|
|
169
184
|
|
|
170
|
-
|
|
171
|
-
|
|
185
|
+
entries.delete(slot) if slot[:children].empty?
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
add_leaf?(entries, path.join('_'), pair)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def join_leaf? entries, path, pair
|
|
192
|
+
return false if @forest.prefix?(path.first)
|
|
193
|
+
return false unless add_leaf?(entries, path.join('_'), pair)
|
|
194
|
+
|
|
195
|
+
@forest.mutated!
|
|
196
|
+
true
|
|
172
197
|
end
|
|
173
198
|
|
|
174
199
|
def add_leaf? entries, name, pair
|
data/lib/yoshiki/version.rb
CHANGED