lib/reek/smell_detectors/data_clump.rb in reek-4.7.2 vs lib/reek/smell_detectors/data_clump.rb in reek-4.7.3
- old
+ new
@@ -48,18 +48,15 @@
#
# Checks the given class or module for multiple identical parameter sets.
#
# @return [Array<SmellWarning>]
#
- # :reek:FeatureEnvy
- def sniff(ctx)
- max_copies = value(MAX_COPIES_KEY, ctx)
- min_clump_size = value(MIN_CLUMP_SIZE_KEY, ctx)
- MethodGroup.new(ctx, min_clump_size, max_copies).clumps.map do |clump, methods|
+ def sniff
+ MethodGroup.new(context, min_clump_size, max_copies).clumps.map do |clump, methods|
methods_length = methods.length
smell_warning(
- context: ctx,
+ context: context,
lines: methods.map(&:line),
message: "takes parameters #{DataClump.print_clump(clump)} " \
"to #{methods_length} methods",
parameters: {
parameters: clump.map(&:to_s),
@@ -69,9 +66,19 @@
end
# @private
def self.print_clump(clump)
"[#{clump.map { |parameter| "'#{parameter}'" }.join(', ')}]"
+ end
+
+ private
+
+ def max_copies
+ value(MAX_COPIES_KEY, context)
+ end
+
+ def min_clump_size
+ value(MIN_CLUMP_SIZE_KEY, context)
end
end
end
# Represents a group of methods