rubocop-flexport 0.6.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 163dbf64bd5550b4f890d2125230be59ba2c1d87e5bf59c513ae206f171852f7
4
- data.tar.gz: f7a597e3f5f770d217ea3be631a95cc8b3b16c73e683ef67b775e5195b95ebcd
3
+ metadata.gz: 1affaedaabe7b84350802f0d4222c052e94d19120c92e556250df045d9f36cc5
4
+ data.tar.gz: efed93fb328d46330498aa2298e3aa5ff872faaab01dae64b06ab279f764d36e
5
5
  SHA512:
6
- metadata.gz: '0444612966a40c981dad3f31b02738232d186a112fc06ba167f93f93630346e72ea14ab3bae765c3336bc17797885d604d87ab30935880941d7c7163b47df34c'
7
- data.tar.gz: 056f32d4e6da4c4eeabaa41340fa096fc87592a8fe3bf4358357b733a380f667ed21112104bb1e6fec26d66bdb14e71223e6085c0c31e784ebfa16e6947d1652
6
+ metadata.gz: 0737a98974780066c5b8a0822825a7a9372cf6b3c155d4b5734fafed971b023e8559e6a77d29f16c9213389b9162f61ea24948d8a2a7dd3f5aeadf820577ab9d
7
+ data.tar.gz: b01a9c75229f63ce3bfef495e622c8c53450fa0cf5ac0cb1f4afddfca21785b8760c3428c90d5bb7144de4e4124112f9843d212d494cc988ddfa6b4963b428a5
@@ -251,7 +251,7 @@ module RuboCop
251
251
  end
252
252
 
253
253
  def sending_method_to_namespace_itself?(node)
254
- node.parent.send_type?
254
+ node.parent&.send_type?
255
255
  end
256
256
 
257
257
  def valid_engine_access?(node, accessed_engine)
@@ -364,11 +364,22 @@ module RuboCop
364
364
  end
365
365
 
366
366
  def engine_specific_override?(node)
367
- module_name = node.parent.source
368
- module_names_allowed_by_override = overrides_by_engine[current_engine]
369
- return false unless module_names_allowed_by_override
367
+ return false unless overrides_for_current_engine
370
368
 
371
- module_names_allowed_by_override.include?(module_name)
369
+ depth = 0
370
+ max_depth = 5
371
+ while node&.const_type? && depth < max_depth
372
+ module_name = node.source
373
+ return true if overrides_for_current_engine.include?(module_name)
374
+
375
+ node = node.parent
376
+ depth += 1
377
+ end
378
+ false
379
+ end
380
+
381
+ def overrides_for_current_engine
382
+ overrides_by_engine[current_engine]
372
383
  end
373
384
 
374
385
  def strongly_protected_engines
@@ -15,7 +15,7 @@ module RuboCop
15
15
  def in_module_or_class_declaration?(node)
16
16
  depth = 0
17
17
  max_depth = 10
18
- while node.const_type? && depth < max_depth
18
+ while node.const_type? && node.parent && depth < max_depth
19
19
  node = node.parent
20
20
  depth += 1
21
21
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Flexport
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-flexport
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flexport Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-21 00:00:00.000000000 Z
11
+ date: 2020-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport