Class: Simplabs::Excellent::Checks::NestedIteratorsCheck
- Defined in:
- lib/simplabs/excellent/checks/nested_iterators_check.rb
Overview
This check reports nested iterators. Nested iterators lead to introduce performance issues.
Applies to
-
blocks
Instance Attribute Summary
Attributes inherited from Base
#interesting_files, #interesting_nodes, #warnings
Instance Method Summary collapse
-
#evaluate(context) ⇒ Object
:nodoc:.
-
#initialize ⇒ NestedIteratorsCheck
constructor
:nodoc:.
Methods inherited from Base
#add_warning, #evaluate_node, #warnings_for
Constructor Details
permalink #initialize ⇒ NestedIteratorsCheck
:nodoc:
16 17 18 19 20 |
# File 'lib/simplabs/excellent/checks/nested_iterators_check.rb', line 16 def initialize #:nodoc: super @interesting_nodes = [:iter] @interesting_files = [/\.rb$/, /\.erb$/] end |
Instance Method Details
permalink #evaluate(context) ⇒ Object
:nodoc:
22 23 24 25 26 |
# File 'lib/simplabs/excellent/checks/nested_iterators_check.rb', line 22 def evaluate(context) #:nodoc: if context.inside_block? add_warning(context, '{{block}} inside of {{parent}}.', { :block => context.full_name, :parent => context.parent.full_name }) end end |