lib/reek/smell_detectors/feature_envy.rb in reek-5.0.2 vs lib/reek/smell_detectors/feature_envy.rb in reek-5.1.0

- old
+ new

@@ -43,10 +43,11 @@ # @return [Array<SmellWarning>] # def sniff return [] if context.singleton_method? || context.module_function? return [] unless context.references_self? + envious_receivers.map do |name, lines| smell_warning( lines: lines, message: "refers to '#{name}' more than self (maybe move it to another class?)", parameters: { name: name.to_s }) @@ -59,9 +60,10 @@ @refs ||= context.refs end def envious_receivers return {} if refs.self_is_max? + refs.most_popular end end end end