Sha256: c2fb7b1b099ee20f8c8188f39c369f78a9ecd597272f5b3a5f3542a9286d0390

Contents?: true

Size: 717 Bytes

Versions: 8

Compression:

Stored size: 717 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      # This check reports nested iterators. Nested iterators lead to introduce performance issues.
      #
      # ==== Applies to
      #
      # * blocks
      class NestedIteratorsCheck < Base

        def initialize #:nodoc:
          super
          @interesting_nodes = [:iter]
          @interesting_files = [/\.rb$/, /\.erb$/]
        end

        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

      end

    end

  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
simplabs-excellent-1.4.0 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.4.1 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.4.2 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.5.0 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.5.1 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.5.2 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.5.3 lib/simplabs/excellent/checks/nested_iterators_check.rb
excellent-1.5.4 lib/simplabs/excellent/checks/nested_iterators_check.rb