lib/rubocop/cop/metrics/block_nesting.rb in rubocop-1.12.1 vs lib/rubocop/cop/metrics/block_nesting.rb in rubocop-1.13.0
- old
+ new
@@ -10,14 +10,11 @@
# option. When set to `false` (the default) blocks are not counted
# towards the nesting level. Set to `true` to count blocks as well.
#
# The maximum level of nesting allowed is configurable.
class BlockNesting < Base
- NESTING_BLOCKS = %i[
- case if while while_post
- until until_post for resbody
- ].freeze
+ NESTING_BLOCKS = %i[case if while while_post until until_post for resbody].freeze
exclude_limit 'Max'
def on_new_investigation
return if processed_source.blank?
@@ -32,12 +29,10 @@
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)) do
- ignore_node(node)
- end
+ add_offense(node, message: message(max)) { ignore_node(node) }
end
end
end
node.each_child_node do |child_node|