class RuboCop::Cop::Metrics::BlockNesting

def check_nesting_level(node, max, current_level)

def check_nesting_level(node, max, current_level)
  if consider_node?(node)
    current_level += 1 unless node.if_type? && node.elsif?
    if current_level > max
      self.max = current_level
      unless part_of_ignored_node?(node)
        add_offense(node, message: message(max)) { ignore_node(node) }
      end
    end
  end
  node.each_child_node do |child_node|
    check_nesting_level(child_node, max, current_level)
  end
end