SmellDetector
A class that publishes a getter or setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.
Currently this detector raises a warning for every attr, attr_reader, attr_writer and attr_accessor – including those that are private.
TODO:
eliminate private attributes
catch attributes declared “by hand”
Checks whether the given class declares any attributes.
@return [Array<SmellWarning>]
# File lib/reek/smells/attribute.rb, line 45 def examine_context(ctx) attributes_in(ctx).map do |attr, line| smell = SmellWarning.new(SMELL_CLASS, ctx.full_name, [line], "declares the attribute #{attr}", @source, SMELL_SUBCLASS, {ATTRIBUTE_KEY => attr.to_s}) smell end end
Generated with the Darkfish Rdoc Generator 2.