Module: RuboCop::Cop::MethodComplexity Private

Extended by:
Macros
Includes:
ConfigurableMax, IgnoredMethods, RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount
Included in:
RuboCop::Cop::Metrics::AbcSize, RuboCop::Cop::Metrics::CyclomaticComplexity
Defined in:
lib/rubocop/cop/mixin/method_complexity.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

This module handles measurement and reporting of complexity in methods.

Instance Method Summary collapse

Methods included from RuboCop::Cop::Metrics::Utils::RepeatedCsendDiscount

#discount_for_repeated_csend?, #reset_on_lvasgn, #reset_repeated_csend

Instance Method Details

#on_block(node) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


21
22
23
24
25
26
27
# File 'lib/rubocop/cop/mixin/method_complexity.rb', line 21

def on_block(node)
  define_method?(node) do |name|
    return if ignored_method?(name)

    check_complexity(node, name)
  end
end

#on_def(node) ⇒ Object Also known as: on_defs

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


14
15
16
17
18
# File 'lib/rubocop/cop/mixin/method_complexity.rb', line 14

def on_def(node)
  return if ignored_method?(node.method_name)

  check_complexity(node, node.method_name)
end