rubocop-yast 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/rubocop/yast/track_variable_scope.rb +14 -17
- data/lib/rubocop/yast/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d00eb7bb7017508fb7e10339707ed05352c97b4
|
4
|
+
data.tar.gz: 6d1d791795cf496f8e1b00c69f65a832b37b9f5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e050ac199100b6740ecf3c6dcc845524e6acce8eb4f64507d86b3b20028c5bac08f0f1892d2c745ee92179677898791690ec1c989fd40fbb0f186d76fa07fec
|
7
|
+
data.tar.gz: 963c8dff14a5cc3962f5eb72f5d7d52c05c86dde5c8070327329b432dde65dcb66415378d5b18d9a35e56b47eaf50349caff58eca7ceefb0190d6c1d47a36054
|
data/CHANGELOG.md
CHANGED
@@ -3,11 +3,6 @@
|
|
3
3
|
require "rubocop/yast/niceness"
|
4
4
|
require "rubocop/yast/variable_scope"
|
5
5
|
|
6
|
-
# We have encountered code that does satisfy our simplifying assumptions,
|
7
|
-
# translating it would not be correct.
|
8
|
-
class TooComplexToTranslateError < Exception
|
9
|
-
end
|
10
|
-
|
11
6
|
module RuboCop
|
12
7
|
module Yast
|
13
8
|
# This module tracks variable usage
|
@@ -143,18 +138,17 @@ module RuboCop
|
|
143
138
|
# (:rescue, begin-block, resbody..., else-block-or-nil)
|
144
139
|
begin_body, *rescue_bodies, else_body = *node
|
145
140
|
|
146
|
-
|
147
|
-
|
148
|
-
|
141
|
+
if rescue_bodies.any? { |r| descendant?(r, :retry) }
|
142
|
+
# do not process if a retry may cause a loop
|
143
|
+
return node
|
144
|
+
end
|
145
|
+
|
149
146
|
process(begin_body)
|
150
147
|
process(else_body)
|
151
148
|
rescue_bodies.each do |r|
|
152
149
|
process(r)
|
153
150
|
end
|
154
|
-
|
155
|
-
node
|
156
|
-
rescue TooComplexToTranslateError
|
157
|
-
warn "begin-rescue is too complex to translate due to a retry"
|
151
|
+
|
158
152
|
node
|
159
153
|
end
|
160
154
|
|
@@ -180,13 +174,16 @@ module RuboCop
|
|
180
174
|
node
|
181
175
|
end
|
182
176
|
|
183
|
-
def on_retry(_node)
|
184
|
-
# that makes the :rescue a loop, top-down data-flow fails
|
185
|
-
raise TooComplexToTranslateError
|
186
|
-
end
|
187
|
-
|
188
177
|
private
|
189
178
|
|
179
|
+
# does node have a particular type as a descendant?
|
180
|
+
def descendant?(node, descendant_type)
|
181
|
+
on_node(descendant_type, node) do
|
182
|
+
return true # short circuit, returns from the method
|
183
|
+
end
|
184
|
+
false
|
185
|
+
end
|
186
|
+
|
190
187
|
def oops(node, exception)
|
191
188
|
puts "Node exception @ #{node.loc.expression}"
|
192
189
|
puts "Offending node: #{node.inspect}"
|
data/lib/rubocop/yast/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-yast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ladislav Slezák
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|