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
-
Kevin Rutherford March 8th, 2009 @ 07:31 PM
- Assigned user set to Kevin Rutherford
- Tag set to defect
In this case I believe the reports of Feature Envy are all fallacious. This is a defect.
-
Kevin Rutherford March 8th, 2009 @ 07:40 PM
Defect has appeared because recent version of ParseTree now renders local method calls differently.
-
Kevin Rutherford March 10th, 2009 @ 08:49 PM
- State changed from new to resolved
(from [09de77b4e1a0e048f0936a19626122cc2e7570fc]) Fixed false reports of FeatureEnvy [#28 state:resolved] http://github.com/kevinrutherfor...
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.
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
- 28 Code convention/"hint" to reduce excessive Feature Envy (from [09de77b4e1a0e048f0936a19626122cc2e7570fc]) Fixed f...