salsify_rubocop 0.47.1 → 0.47.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a235a0d2d7c100c09da10c768f5a7e8384d30b8c
4
- data.tar.gz: f1c310ca03dea3a45efc6b0c104a5b8411a827ae
3
+ metadata.gz: 01ddf57339e753b601e0bbbefda0a87141ee09c5
4
+ data.tar.gz: 964f0c25cd592a0ca6a9949f3a4c05fa3d4630f3
5
5
  SHA512:
6
- metadata.gz: 9c788c146e8be102a39e8340c22c1b391a2fbaef4e6cfae70c93142414af839dd69625e4cdd9f897846d43e1fa602c866e4351f624124f2ba4dab31ed193ccfd
7
- data.tar.gz: d445a00088b9745687e1a2f1670e91d3b736d927b96081dfc23d3721cf75c731fbb587d09cc11b98a3cd4013e94d064e69442bd64dc96b4d9a758be5fc502f6b
6
+ metadata.gz: 4b5a9ed9d733e36708b4a75d14c6c82121f18eeb71fb16b542d9a8c1719a0a0580f61df67c5b793e240ab515ac4963f9adc3a90511d21e3ac3f737afb330cbec
7
+ data.tar.gz: bc07f258e1f8fc671f8f0ed2e763dc072a35bbfc300821e2585d9ee7ab631dd606af31e9dc823de9de4468651708eb2b49b087fabd9ba9828f542d45a6ada720
@@ -1,5 +1,9 @@
1
1
  # salsify_rubocop
2
2
 
3
+ ## v0.47.2
4
+ - Fix issue for `Salsify/Style` with nested access as the target for
5
+ conditional assignment.
6
+
3
7
  ## v0.47.1
4
8
  - Add `Salsify/StyleDig` cop to recommend using `#dig` for deeply nested access.
5
9
  - Add `Salsify/RailsApplicationRecord` cop.
@@ -28,7 +28,7 @@ module RuboCop
28
28
  PATTERN
29
29
 
30
30
  def on_send(node)
31
- nested_access_match(node) do
31
+ if nested_access_match(node) && !conditional_assignment?(node)
32
32
  match_node = node
33
33
  # walk to outermost access node
34
34
  match_node = match_node.parent while access_node?(match_node.parent)
@@ -55,6 +55,10 @@ module RuboCop
55
55
 
56
56
  private
57
57
 
58
+ def conditional_assignment?(node)
59
+ node.parent && node.parent.or_asgn_type? && (node.parent.children.first == node)
60
+ end
61
+
58
62
  def access_node?(node)
59
63
  node && node.send_type? && node.method_name == :[]
60
64
  end
@@ -1,3 +1,3 @@
1
1
  module SalsifyRubocop
2
- VERSION = '0.47.1'.freeze
2
+ VERSION = '0.47.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salsify_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.1
4
+ version: 0.47.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-07 00:00:00.000000000 Z
11
+ date: 2017-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler