Skip to content

Commit

Permalink
UtilityFunction: drop max_helper_calls
Browse files Browse the repository at this point in the history
  • Loading branch information
chastell committed Apr 18, 2015
1 parent 38d2dca commit 19b191c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion config/defaults.reek
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,3 @@ UnusedParameters:
UtilityFunction:
enabled: true
exclude: []
max_helper_calls: 0
15 changes: 1 addition & 14 deletions lib/reek/smells/utility_function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ module Smells
# +FeatureEnvy+ is reported instead.
#
class UtilityFunction < SmellDetector
# The name of the config field that sets the maximum number of
# calls permitted within a helper method. Any method with more than
# this number of method calls on other objects will be considered a
# candidate Utility Function.
HELPER_CALLS_LIMIT_KEY = 'max_helper_calls'
DEFAULT_HELPER_CALLS_LIMIT = 0

def self.smell_category
'LowCohesion'
end
Expand All @@ -50,10 +43,6 @@ class << self
def contexts # :nodoc:
[:def]
end

def default_config
super.merge(HELPER_CALLS_LIMIT_KEY => DEFAULT_HELPER_CALLS_LIMIT)
end
end

#
Expand All @@ -64,9 +53,7 @@ def default_config
def examine_context(method_ctx)
return [] if method_ctx.num_statements == 0
return [] if method_ctx.references_self?
return [] if num_helper_methods(method_ctx) <= value(HELPER_CALLS_LIMIT_KEY,
method_ctx,
DEFAULT_HELPER_CALLS_LIMIT)
return [] if num_helper_methods(method_ctx).zero?

[SmellWarning.new(self,
context: method_ctx.full_name,
Expand Down

0 comments on commit 19b191c

Please sign in to comment.