lib/scss_lint/options.rb in scss-lint-0.31.0 vs lib/scss_lint/options.rb in scss-lint-0.32.0
- old
+ new
@@ -1,11 +1,11 @@
require 'optparse'
module SCSSLint
# Handles option parsing for the command line application.
class Options
- DEFAULT_REPORTER = [SCSSLint::Reporter::DefaultReporter, :stdout]
+ DEFAULT_REPORTER = ['Default', :stdout]
# Parses command line options into an options hash.
#
# @param args [Array<String>] arguments passed via the command line
# @return [Hash] parsed options
@@ -46,17 +46,13 @@
end
end
# @param format [String]
def define_output_format(format)
- unless @options[:reporters] == [DEFAULT_REPORTER] && format == 'Default'
- @options[:reporters].reject! { |i| i == DEFAULT_REPORTER }
- reporter = SCSSLint::Reporter.const_get(format + 'Reporter')
- @options[:reporters] << [reporter, :stdout]
- end
- rescue NameError
- raise SCSSLint::Exceptions::InvalidCLIOption,
- "Invalid output format specified: #{format}"
+ return if @options[:reporters] == [DEFAULT_REPORTER] && format == 'Default'
+
+ @options[:reporters].reject! { |i| i == DEFAULT_REPORTER }
+ @options[:reporters] << [format, :stdout]
end
def add_linter_options(parser)
parser.on('-i', '--include-linter linter,...', Array,
'Specify which linters you want to run') do |linters|