Sha256: 8068bc967e31dfb15ffb4d869ba50568b820cb1bb289a14f58fd2ecbfc169a89

Contents?: true

Size: 995 Bytes

Versions: 3

Compression:

Stored size: 995 Bytes

Contents

# frozen_string_literal: true
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,
                                               filter_by_smells: 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

3 entries across 3 versions & 1 rubygems

Version Path
reek-4.0.1 lib/reek/cli/command/report_command.rb
reek-4.0.0 lib/reek/cli/command/report_command.rb
reek-4.0.0.pre1 lib/reek/cli/command/report_command.rb