SmellDetector
A Nested Iterator occurs when a block contains another block.
NestedIterators reports failing methods only once.
The name of the config field that sets the names of any methods for which nesting should not be considered
The name of the config field that sets the maximum depth of nested iterators to be permitted within any single method.
SMELL: should be a subclass of UnnecessaryComplexity
Checks whether the given block is inside another.
@return [Array<SmellWarning>]
# File lib/reek/smells/nested_iterators.rb, line 47 def examine_context(ctx) @ignore_iterators = value(IGNORE_ITERATORS_KEY, ctx, DEFAULT_IGNORE_ITERATORS) @max_allowed_nesting = value(MAX_ALLOWED_NESTING_KEY, ctx, DEFAULT_MAX_ALLOWED_NESTING) find_deepest_iterators(ctx).map do |iter| depth = iter[1] SmellWarning.new(SMELL_CLASS, ctx.full_name, [iter[0].line], "contains iterators nested #{depth} deep", @source, SMELL_SUBCLASS, {NESTING_DEPTH_KEY => depth}) end # BUG: no longer reports nesting outside methods (eg. in Optparse) end
Generated with the Darkfish Rdoc Generator 2.