Sha256: 9d5e6a6405d34ae710c9f074b87691a85d07124f97bb16210d7b32c87416ef12

Contents?: true

Size: 947 Bytes

Versions: 1

Compression:

Stored size: 947 Bytes

Contents

require_relative 'base_command'
require_relative '../../examiner'

module Reek
  module CLI
    module Command
      #
      # A command to collect smells from a set of sources and write them out in
      # text report format.
      #
      class ReportCommand < BaseCommand
        def execute(app)
          populate_reporter_with_smells app
          reporter.show
          result_code
        end

        private

        def populate_reporter_with_smells(app)
          sources.each do |source|
            reporter.add_examiner Examiner.new(source,
                                               smell_names,
                                               configuration: app.configuration)
          end
        end

        def result_code
          reporter.smells? ? options.failure_exit_code : options.success_exit_code
        end

        def reporter
          @reporter ||= options.reporter
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reek-3.11 lib/reek/cli/command/report_command.rb