Sha256: 73a1c4c1af7cc367ba64a405abbe63e6b5725504110d8074055060998a1c8b6f

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

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

        def initialize(options = {}) #: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-2.1.1 lib/simplabs/excellent/checks/nested_iterators_check.rb
excellent-2.1.0 lib/simplabs/excellent/checks/nested_iterators_check.rb
excellent-2.0.1 lib/simplabs/excellent/checks/nested_iterators_check.rb
excellent-2.0.0 lib/simplabs/excellent/checks/nested_iterators_check.rb