Sha256: 96d725cc61d0f5b9ed25597c4c8ecf8307ea7b47814cb9427498759391ad12c5
Contents?: true
Size: 855 Bytes
Versions: 1
Compression:
Stored size: 855 Bytes
Contents
$:.unshift File.dirname(__FILE__) require 'reek/smells/smell' module Reek module Smells # # A Long Parameter List occurs when a method has more than one # or two parameters, or when a method yields more than one or # two objects to an associated block. # # Currently +LongParameterList+ reports any method with more # than +MAX_ALLOWED+ parameters. # class LongParameterList < Smell MAX_ALLOWED = 3 def self.count_parameters(exp) result = exp.length - 1 result -= 1 if Array === exp[-1] and exp[-1][0] == :block result end def recognise?(args) @num_params = LongParameterList.count_parameters(args) @num_params > MAX_ALLOWED end def detailed_report "#{@context.to_s} has #{@num_params} parameters" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reek-0.3.1 | lib/reek/smells/long_parameter_list.rb |