Sha256: b0ba5a690862fd167b2cd664ce3c931741db37fb39b6cd999c59c0041f165e8f

Contents?: true

Size: 982 Bytes

Versions: 2

Compression:

Stored size: 982 Bytes

Contents

require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'examiner')

module Reek
  module Cli

    #
    # A command to collect smells from a set of sources and write them out in
    # text report format.
    #
    class ReekCommand
      def self.create(sources, report_class, show_all)
        examiners = sources.map {|src| Examiner.new(src) }
        new(examiners, report_class, show_all)
      end

      def initialize(examiners, report_class, show_all)
        @examiners = examiners
        @report_class = report_class
        @show_all = show_all    #SMELL: boolean parameter
      end

      def execute(view)
        had_smells = false
        @examiners.each do |examiner|
          rpt = @report_class.new(examiner, @show_all)
          had_smells ||= examiner.smelly?
          view.output(rpt.report)
        end
        if had_smells
          view.report_smells
        else
          view.report_success
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reek-1.2.7.1 lib/reek/cli/reek_command.rb
reek-1.2.7 lib/reek/cli/reek_command.rb