rubocop-yast 0.0.8 → 0.0.9

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
  SHA1:
3
- metadata.gz: ab9d34ebc702b4f960ea9052af25796369d11d60
4
- data.tar.gz: 0562543d6aca25bd76a0f933fcfd8670cde680cf
3
+ metadata.gz: 3d00eb7bb7017508fb7e10339707ed05352c97b4
4
+ data.tar.gz: 6d1d791795cf496f8e1b00c69f65a832b37b9f5b
5
5
  SHA512:
6
- metadata.gz: 8f8c2c95efd7d2e58b78258fae535b1e3c671dbfdb3a108daf9231ae7224f46d21b81912622951635065c0c5364faaa0f509b68b95815992427412e8ee6a5784
7
- data.tar.gz: 9fe4dfebd32eea8427cf671018187e60361d99fdb5089e3e4c1d35c2db30278ac11689a1823b233bf5e5dadb5f45e53b37828977dc8e85354d46acbc5392d06e
6
+ metadata.gz: 9e050ac199100b6740ecf3c6dcc845524e6acce8eb4f64507d86b3b20028c5bac08f0f1892d2c745ee92179677898791690ec1c989fd40fbb0f186d76fa07fec
7
+ data.tar.gz: 963c8dff14a5cc3962f5eb72f5d7d52c05c86dde5c8070327329b432dde65dcb66415378d5b18d9a35e56b47eaf50349caff58eca7ceefb0190d6c1d47a36054
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.0.9 (2016-01-26)
6
+
7
+ ### Changes
8
+
9
+ - Fixed: does not translate a `begin`-body when a `rescue` contains a `retry`.
10
+
5
11
  ## 0.0.8 (2015-12-11)
6
12
 
7
13
  ### New Features
@@ -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
- # FIXME: the transaction must be rolled back
147
- # by the TooComplexToTranslateError
148
- # @source_rewriter.transaction do
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
- # end
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}"
@@ -3,6 +3,6 @@
3
3
  module RuboCop
4
4
  # Yast plugin settings
5
5
  module Yast
6
- VERSION = "0.0.8"
6
+ VERSION = "0.0.9"
7
7
  end
8
8
  end
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.8
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: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2016-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop