#28 ✓resolved
Ashley Moran

Code convention/"hint" to reduce excessive Feature Envy

Reported by Ashley Moran | March 8th, 2009 @ 04:30 PM

Just brain dumping here but how about if reek saw this:

class FarmYard
  attr_reader :cow, :duck, :pig
  
  def ==(other_farm_yard)
    cow == other_farm_yard.cow &&
      duck == other_farm_yard.duck
  end

  def foot_and_mouth(thing)
    cow.feed_to(thing.pig)
    duck.feed_to(thing.pig)
  end
end

it ignored the feature envy in #== because it could see the class name inflected in the parameter other_farm_yard but not in thing.

Not sure this is a good idea - conventions can be opaque - but this is a fairly common case.

WDYT?

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Defects and feature requests for <a href="http://wiki.github.com/kevinrutherford/reek">Reek</a>, the Ruby code smell detector

People watching this ticket

Tags

Referenced by

Pages