lib/reek/smells/duplicate_method_call.rb
#
# Looks for duplicate calls within the body of the method +ctx+.
#
# @return [Array<SmellWarning>]
#
Looks for duplicate calls within the body of the method +ctx+.
Looks for duplicate calls within the body of the method + ctx + .
def examine_context(ctx)
        max_allowed_calls = value(MAX_ALLOWED_CALLS_KEY, ctx, DEFAULT_MAX_CALLS)
        allow_calls = value(ALLOW_CALLS_KEY, ctx, DEFAULT_ALLOW_CALLS)
        CallCollector.new(ctx, max_allowed_calls, allow_calls).smelly_calls.map do |found_call|
          SmellWarning.new self,
                           context: ctx.full_name,
                           lines: found_call.lines,
                           message: "calls #{found_call.call} #{found_call.occurs} times",
                           parameters: { CALL_KEY => found_call.call, OCCURRENCES_KEY => found_call.occurs }
        end
      end
def examine_context ( ctx ) max_allowed_calls = value ( MAX_ALLOWED_CALLS_KEY , ctx , DEFAULT_MAX_CALLS ) allow_calls = value ( ALLOW_CALLS_KEY , ctx , DEFAULT_ALLOW_CALLS ) CallCollector . new ( ctx , max_allowed_calls , allow_calls ) . smelly_calls . map do | found_call | SmellWarning . new self , context : ctx . full_name , lines : found_call . lines , message : "calls #{found_call.call} #{found_call.occurs} times" , parameters : { CALL_KEY => found_call . call , OCCURRENCES_KEY => found_call . occurs } end end
Looks for duplicate calls within the body of the method +ctx+.
Looks for duplicate calls within the body of the method + ctx + .
None
Array<SmellWarning>
ctx
<not_specific>