lib/reek/smell_detectors/data_clump.rb in reek-4.8.2 vs lib/reek/smell_detectors/data_clump.rb in reek-5.0.0
- old
+ new
@@ -22,19 +22,19 @@
# The name of the config field that sets the maximum allowed
# copies of any clump. No group of common parameters will be
# reported as a DataClump unless there are more than this many
# methods containing those parameters.
#
- MAX_COPIES_KEY = 'max_copies'.freeze
+ MAX_COPIES_KEY = 'max_copies'
DEFAULT_MAX_COPIES = 2
#
# The name of the config field that sets the minimum clump
# size. No group of common parameters will be reported as
# a DataClump unless it contains at least this many parameters.
#
- MIN_CLUMP_SIZE_KEY = 'min_clump_size'.freeze
+ MIN_CLUMP_SIZE_KEY = 'min_clump_size'
DEFAULT_MIN_CLUMP_SIZE = 2
def self.contexts # :nodoc:
[:class, :module]
end
@@ -52,11 +52,10 @@
#
def sniff
MethodGroup.new(context, min_clump_size, max_copies).clumps.map do |clump, methods|
methods_length = methods.length
smell_warning(
- context: context,
lines: methods.map(&:line),
message: "takes parameters #{DataClump.print_clump(clump)} " \
"to #{methods_length} methods",
parameters: {
parameters: clump.map(&:to_s),
@@ -99,10 +98,10 @@
end.select do |clump|
clump.length >= min_clump_size
end.uniq
end
- # :reek:UtilityFunction
+ # @quality :reek:UtilityFunction
def common_argument_names_for(methods)
methods.map(&:arg_names).inject(:&)
end
def methods_containing_clump(clump)