Sha256: afb4cae362cf5e1d963c3887904cddff70aae96be1582e7dfe5e979dfa74f504

Contents?: true

Size: 656 Bytes

Versions: 15

Compression:

Stored size: 656 Bytes

Contents

require 'reek/smells/smell_detector'
require 'reek/smell_warning'

module Reek
  module Smells

    #
    # A Nested Iterator occurs when a block contains another block.
    #
    # +NestedIterators+ reports failing methods only once.
    #
    class NestedIterators < SmellDetector

      def self.contexts      # :nodoc:
        [:iter]
      end

      #
      # Checks whether the given +block+ is inside another.
      # Any smells found are added to the +report+.
      #
      def examine_context(block, report)
        return false unless block.nested_block?
        report << SmellWarning.new(self, block, 'is nested')
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
kevinrutherford-reek-0.3.1.4 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-0.3.1.5 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-0.3.1.6 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.0.0 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.0.1 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.1.1 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.1.2.1 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.1.2 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.1.3.1 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.1.3.2 lib/reek/smells/nested_iterators.rb
kevinrutherford-reek-1.1.3 lib/reek/smells/nested_iterators.rb
teksymmetry-reek-1.1.3.1 lib/reek/smells/nested_iterators.rb
teksymmetry-reek-1.1.3.2 lib/reek/smells/nested_iterators.rb
reek-1.1.3 lib/reek/smells/nested_iterators.rb
reek-1.0.0 lib/reek/smells/nested_iterators.rb