Sha256: 41bfd404e38da60d2fdd8aa0862f3e86615a3832ec2ca1a8bc91bbe497c992ab

Contents?: true

Size: 958 Bytes

Versions: 8

Compression:

Stored size: 958 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, config_files = [])
        new(report_class, sources, config_files)
      end

      def initialize(report_class, sources, config_files = [])
        @sources = sources
        @report_class = report_class
        @config_files = config_files
      end

      def execute(view)
        had_smells = false
        @sources.each do |source|
          examiner = Examiner.new(source, @config_files)
          rpt = @report_class.new(examiner)
          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

8 entries across 8 versions & 1 rubygems

Version Path
reek-1.3.1 lib/reek/cli/reek_command.rb
reek-1.3 lib/reek/cli/reek_command.rb
reek-1.2.13 lib/reek/cli/reek_command.rb
reek-1.2.12 lib/reek/cli/reek_command.rb
reek-1.2.11 lib/reek/cli/reek_command.rb
reek-1.2.10 lib/reek/cli/reek_command.rb
reek-1.2.9 lib/reek/cli/reek_command.rb
reek-1.2.8 lib/reek/cli/reek_command.rb