lib/reek/smells/boolean_parameter.rb
#
# Checks whether the given method has any Boolean parameters.
#
# @return [Array<SmellWarning>]
#
Checks whether the given method has any Boolean parameters.
Checks whether the given method has any Boolean parameters .
def examine_context(method_ctx)
        method_ctx.parameters.default_assignments.select do |_param, value|
          [:true, :false].include?(value[0])
        end.map do |parameter, _value|
          SmellWarning.new self,
                           context: method_ctx.full_name,
                           lines: [method_ctx.exp.line],
                           message: "has boolean parameter '#{parameter}'",
                           parameters: { PARAMETER_KEY => parameter.to_s }
        end
      end
def examine_context ( method_ctx ) method_ctx . parameters . default_assignments . select do | _param , value | [ :true , :false ] . include? ( value [ 0 ] ) end . map do | parameter , _value | SmellWarning . new self , context : method_ctx . full_name , lines : [ method_ctx . exp . line ] , message : "has boolean parameter '#{parameter}'" , parameters : { PARAMETER_KEY => parameter . to_s } end end
Checks whether the given method has any Boolean parameters.
Checks whether the given method has any Boolean parameters .
None
Array<SmellWarning>
method_ctx
<not_specific>