vendor/jruby/1.9/gems/reek-1.6.5/lib/reek/smells/repeated_conditional.rb
#
# Checks the given class for multiple identical conditional tests.
#
# @return [Array<SmellWarning>]
#
Checks the given class for multiple identical conditional tests.
Checks the given class for multiple identical conditional tests .
def examine_context(ctx)
        @max_identical_ifs = value(MAX_IDENTICAL_IFS_KEY, ctx, DEFAULT_MAX_IFS)
        conditional_counts(ctx).select do |_key, lines|
          lines.length > @max_identical_ifs
        end.map do |key, lines|
          occurs = lines.length
          expression = key.format_ruby
          SmellWarning.new self,
                           context: ctx.full_name,
                           lines: lines,
                           message: "tests #{expression} at least #{occurs} times",
                           parameters: { name: expression, count: occurs }
        end
      end
def examine_context ( ctx ) @max_identical_ifs = value ( MAX_IDENTICAL_IFS_KEY , ctx , DEFAULT_MAX_IFS ) conditional_counts ( ctx ) . select do | _key , lines | lines . length > @max_identical_ifs end . map do | key , lines | occurs = lines . length expression = key . format_ruby SmellWarning . new self , context : ctx . full_name , lines : lines , message : "tests #{expression} at least #{occurs} times" , parameters : { name : expression , count : occurs } end end
Checks the given class for multiple identical conditional tests.
Checks the given class for multiple identical conditional tests .
None
Array<SmellWarning>
ctx