Sha256: 1831a3dae178df83cebac9792b7e67b4a95fb59bb564de2a36b2a2e466eb18d0
Contents?: true
Size: 1.94 KB
Versions: 4
Compression:
Stored size: 1.94 KB
Contents
require 'forwardable' require_relative 'input' require_relative '../report/report' require_relative '../report/formatter' require_relative '../report/heading_formatter' module Reek module CLI # # Interprets the options set from the command line # # @api private class OptionInterpreter include Input extend Forwardable def_delegators :@options, :smells_to_detect def initialize(options) @options = options @argv = @options.argv end def reporter @reporter ||= report_class.new( warning_formatter: warning_formatter, report_formatter: Report::Formatter, sort_by_issue_count: sort_by_issue_count, heading_formatter: heading_formatter) end # TODO: Move report type mapping into Report def report_class case @options.report_format when :yaml Report::YAMLReport when :json Report::JSONReport when :html Report::HTMLReport when :xml Report::XMLReport else # :text Report::TextReport end end def warning_formatter klass = if @options.show_links Report::WikiLinkWarningFormatter else Report::SimpleWarningFormatter end klass.new(location_formatter) end def location_formatter case @options.location_format when :single_line Report::SingleLineLocationFormatter when :plain Report::BlankLocationFormatter else # :numbers Report::DefaultLocationFormatter end end def heading_formatter if @options.show_empty Report::HeadingFormatter::Verbose else Report::HeadingFormatter::Quiet end end def sort_by_issue_count @options.sorting == :smelliness end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
reek-3.0.3 | lib/reek/cli/option_interpreter.rb |
reek-3.0.2 | lib/reek/cli/option_interpreter.rb |
reek-3.0.1 | lib/reek/cli/option_interpreter.rb |
reek-3.0.0 | lib/reek/cli/option_interpreter.rb |