Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2018-08-27 16:24:11 +0300
committerJacopo <beschi.jacopo@gmail.com>2018-08-29 17:56:34 +0300
commita1cad13b923f44e56dc990c528e09c5c9750a8f4 (patch)
treeb0de4dd4e6cd4da2f0af4ed95c29b8297a494d21 /rubocop
parentc6bddeacf4775b79edc9896f30da3c1f4136d4d1 (diff)
Fixes rubocop chain ordinary method after safe navigation operator
Diffstat (limited to 'rubocop')
-rw-r--r--rubocop/cop/prefer_class_methods_over_module.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/rubocop/cop/prefer_class_methods_over_module.rb b/rubocop/cop/prefer_class_methods_over_module.rb
index 496d2ed249f..ed10229b69a 100644
--- a/rubocop/cop/prefer_class_methods_over_module.rb
+++ b/rubocop/cop/prefer_class_methods_over_module.rb
@@ -48,12 +48,15 @@ module RuboCop
private
def extends_activesupport_concern?(node)
- container_module(node.parent)&.descendants.any? do |descendant|
+ container_module = container_module_of(node.parent)
+ return false unless container_module
+
+ container_module.descendants.any? do |descendant|
extend_activesupport_concern?(descendant)
end
end
- def container_module(node)
+ def container_module_of(node)
node = node.parent until node.type == :module
node