lib/reek/smells/feature_envy.rb in reek-1.2.7.3 vs lib/reek/smells/feature_envy.rb in reek-1.2.8
- old
+ new
@@ -41,19 +41,18 @@
REFERENCES_KEY = 'references'
#
# Checks whether the given +context+ includes any code fragment that
# might "belong" on another class.
- # Remembers any smells found.
#
+ # @return [Array<SmellWarning>]
+ #
def examine_context(method_ctx)
- method_ctx.envious_receivers.each do |ref, occurs|
- target = ref.format
- smell = SmellWarning.new(SMELL_CLASS, method_ctx.full_name, [method_ctx.exp.line],
- "refers to #{target} more than self",
- @source, SMELL_SUBCLASS, {RECEIVER_KEY => target, REFERENCES_KEY => occurs})
- @smells_found << smell
- #SMELL: serious duplication
+ method_ctx.envious_receivers.map do |ref, occurs|
+ target = ref.format_ruby
+ SmellWarning.new(SMELL_CLASS, method_ctx.full_name, [method_ctx.exp.line],
+ "refers to #{target} more than self",
+ @source, SMELL_SUBCLASS, {RECEIVER_KEY => target, REFERENCES_KEY => occurs})
end
end
end
end
end