Sha256: 48b3d8330634dc82eea7e7d808ef17bba22c19c2dcb1f89c2cc0a26e2375152b
Contents?: true
Size: 926 Bytes
Versions: 13
Compression:
Stored size: 926 Bytes
Contents
require 'reek/smells/smell_detector' require 'reek/smell_warning' module Reek module Smells # # A Utility Function is any instance method that has no # dependency on the state of the instance. # # Currently +UtilityFunction+ will warn about any method that: # # * is non-empty # * does not override an inherited method # * calls at least one method on another object # * doesn't use any of self's instance variables # * doesn't use any of self's methods # class UtilityFunction < SmellDetector # # Checks whether the given +method+ is a utility function. # Remembers any smells found. # def examine_context(method) return false if method.calls.keys.length == 0 or method.num_statements == 0 or method.depends_on_instance? found(method, "doesn't depend on instance state") end end end end
Version data entries
13 entries across 13 versions & 1 rubygems