Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 987 Bytes

Long-Yield-List.md

File metadata and controls

37 lines (25 loc) · 987 Bytes

Long Yield List

Introduction

A Long Yield List occurs when a method yields a lot of arguments to the block it gets passed. It is a special case of Long Parameter List.

Example

class Dummy
  def yields_a_lot(foo,bar,baz,fling,flung)
    yield foo,bar,baz,fling,flung
  end
end

Reek would report the following warning:

test.rb -- 1 warning:
  [4]:Dummy#yields_a_lot yields 5 parameters (LongYieldList)

A common solution to this problem would be the introduction of parameter objects.

Current Support in Reek

Currently Long Yield List reports any method or block with more than 3 parameters.

Configuration

Reek's Long Yield List detector supports the Basic Smell Options, plus:

Option Value Effect
max_params integer The maximum number of parameters allowed in a method or block before a warning is issued. Defaults to 3.