Control Parameter is a case of Control Couple.
A simple example would be the quoted
parameter in the following method:
def write(quoted)
if quoted
write_quoted @value
else
write_unquoted @value
end
end
Fixing those problems is out of the scope of this document but an easy solution
could be to remove the write
method altogether and to move the calls to
write_quoted
and write_unquoted
to the caller of write
.
Reek warns about Control Parameter when a method parameter or block parameter is the tested value in a conditional statement.
Control Parameter supports the Basic Smell Options.