DuplicateMethodCall
https://github.com/troessner/reek/blob/master/docs/Duplicate-Method-Call.md Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.
example:
def double_thing()
@other.thing + @other.thing
end
fix:
def double_thing()
thing = @other.thing
thing + thing
end
UtilityFunction
https://github.com/troessner/reek/blob/master/docs/Utility-Function.md A Utility Function is any instance method that has no dependency on the state of the instance.
example:
class UtilityFunction
def showcase(argument)
argument.to_s + argument.to_i
end
end
fix: move to diff file cause it does not belongs to this class.
TooManyStatements
Any method that has a large number of lines.
So the following method would score +6 in Reek's statement-counting algorithm:
def parse(arg, argv, &error)
if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
return nil, block, nil # +1
end
opt = (val = parse_arg(val, &error))[1] # +2
val = conv_arg(*val) # +3
if opt and !arg
argv.shift # +4
else
val[0] = nil # +5
end
val # +6
end
fix: decide with team which number fits to you and add specific configuration.