Class: Reek::Smells::NestedIterators
- Inherits:
-
SmellDetector
- Object
- SmellDetector
- Reek::Smells::NestedIterators
- Defined in:
- lib/reek/smells/nested_iterators.rb
Overview
A Nested Iterator occurs when a block contains another block.
NestedIterators
reports failing methods only once.
Constant Summary
Constants inherited from SmellDetector
SmellDetector::ENABLED_KEY, SmellDetector::EXCLUDE_KEY
Class Method Summary collapse
-
.contexts ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#examine_context(block, report) ⇒ Object
Checks whether the given
block
is inside another.
Methods inherited from SmellDetector
class_name, default_config, #examine, #exception?, #initialize, listen, #smell_name
Constructor Details
This class inherits a constructor from Reek::Smells::SmellDetector
Class Method Details
.contexts ⇒ Object
:nodoc:
14 15 16 |
# File 'lib/reek/smells/nested_iterators.rb', line 14 def self.contexts # :nodoc: [:iter] end |
Instance Method Details
#examine_context(block, report) ⇒ Object
Checks whether the given block
is inside another. Any smells found are added to the report
.
22 23 24 25 |
# File 'lib/reek/smells/nested_iterators.rb', line 22 def examine_context(block, report) return false unless block.nested_block? report << SmellWarning.new(self, block, 'is nested') end |