diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2018-08-27 15:24:11 +0200 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2018-08-29 16:56:34 +0200 |
commit | a1cad13b923f44e56dc990c528e09c5c9750a8f4 (patch) | |
tree | b0de4dd4e6cd4da2f0af4ed95c29b8297a494d21 /rubocop | |
parent | c6bddeacf4775b79edc9896f30da3c1f4136d4d1 (diff) | |
download | gitlab-ce-a1cad13b923f44e56dc990c528e09c5c9750a8f4.tar.gz |
Fixes rubocop chain ordinary method after safe navigation operator
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/prefer_class_methods_over_module.rb | 7 |
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 |