Sha256: 6ff375bfbd0f026dc0f744ecde2694bb9c53a054cdc29dd33fc83d04f4b37954

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 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_contexts = [Parsing::BlockContext]
          @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

4 entries across 4 versions & 1 rubygems

Version Path
excellent-1.7.2 lib/simplabs/excellent/checks/nested_iterators_check.rb
excellent-1.7.1 lib/simplabs/excellent/checks/nested_iterators_check.rb
excellent-1.7.0 lib/simplabs/excellent/checks/nested_iterators_check.rb
excellent-1.6.0 lib/simplabs/excellent/checks/nested_iterators_check.rb