Sha256: a2479c3dfef5267b72e43daaa9f4053254b7924d2a449e3befba40bea0cdc316

Contents?: true

Size: 666 Bytes

Versions: 4

Compression:

Stored size: 666 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]
        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

4 entries across 4 versions & 1 rubygems

Version Path
simplabs-excellent-1.2.1 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.2.2 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.3.0 lib/simplabs/excellent/checks/nested_iterators_check.rb
simplabs-excellent-1.3.1 lib/simplabs/excellent/checks/nested_iterators_check.rb