lib/reek/smells/duplicate_method_call.rb in reek-3.11 vs lib/reek/smells/duplicate_method_call.rb in reek-4.0.0.pre1
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
require_relative 'smell_detector'
require_relative 'smell_warning'
module Reek
module Smells
@@ -27,14 +28,10 @@
# methods for which identical calls should be to be permitted
# within any single method.
ALLOW_CALLS_KEY = 'allow_calls'.freeze
DEFAULT_ALLOW_CALLS = [].freeze
- def self.smell_category
- 'Duplication'
- end
-
def self.default_config
super.merge(
MAX_ALLOWED_CALLS_KEY => DEFAULT_MAX_CALLS,
ALLOW_CALLS_KEY => DEFAULT_ALLOW_CALLS
)
@@ -87,10 +84,12 @@
private
attr_reader :call_node, :occurences
end
+ private_constant :FoundCall
+
# Collects all calls in a given context
class CallCollector
attr_reader :context
def initialize(context, max_allowed_calls, allow_calls)
@@ -137,8 +136,10 @@
def allow_calls?(method)
allow_calls.any? { |allow| /#{allow}/ =~ method }
end
end
+
+ private_constant :CallCollector
end
end
end