Sha256: 77527799b5e0df563dcec477d32dd490608cdbc8d761a4a83c1ada5aed4dae6e

Contents?: true

Size: 795 Bytes

Versions: 8

Compression:

Stored size: 795 Bytes

Contents

module Reek
  class DetectorStack

    def initialize(default_detector)
      @detectors = [default_detector]
    end

    def push(config)
      clone = @detectors[-1].supersede_with(config)
      @detectors << clone
    end

    def listen_to(hooks)
      @detectors.each { |det| det.listen_to(hooks) }
    end

    def report_on(report)
      @detectors.each { |det| det.report_on(report) }
    end

    def num_smells
      total = 0
      @detectors.each { |det| total += det.num_smells }
      total
    end

    def has_smell?(patterns)
      @detectors.each { |det| return true if det.has_smell?(patterns) }
      false
    end

    def smelly?
      # SMELL: Duplication: look at al those loops!
      @detectors.each { |det| return true if det.smelly? }
      false
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
kevinrutherford-reek-1.1.3.14 lib/reek/detector_stack.rb
kevinrutherford-reek-1.1.3.15 lib/reek/detector_stack.rb
kevinrutherford-reek-1.1.3.16 lib/reek/detector_stack.rb
kevinrutherford-reek-1.2.0 lib/reek/detector_stack.rb
reek-1.2.3 lib/reek/detector_stack.rb
reek-1.2.2 lib/reek/detector_stack.rb
reek-1.2.1 lib/reek/detector_stack.rb
reek-1.2.0 lib/reek/detector_stack.rb