lib/reek/smells.rb in reek-0.0.1 vs lib/reek/smells.rb in reek-0.1.0
- old
+ new
@@ -101,19 +101,18 @@
@receiver = receiver
end
def recognise?(calls)
max = calls.empty? ? 0 : calls.values.max
- mine = calls[:self]
- return false unless max > mine
+ return false unless max > calls[:self]
receivers = calls.keys.select { |key| calls[key] == max }
@receiver = receivers.map {|r| Printer.print(r)}.sort.join(' or ')
return true
end
def detailed_report
- "#{@context} could be moved to #{@receiver}"
+ "#{@context} uses #{@receiver} more than self"
end
end
class UtilityFunction < Smell
def recognise?(calls)
@@ -152,8 +151,18 @@
@symbol.length < min_len
end
def detailed_report
"#{@context} uses the #{@symbol_type} name '#{@symbol}'"
+ end
+ end
+
+ class NestedIterators < Smell
+ def recognise?(already_in_iter)
+ already_in_iter
+ end
+
+ def detailed_report
+ "#{@context} has nested iterators"
end
end
end