lib/scss_lint/cli.rb in scss_lint-0.49.0 vs lib/scss_lint/cli.rb in scss_lint-0.50.0
- old
+ new
@@ -61,26 +61,30 @@
end
end
def scan_for_lints(options, config)
runner = Runner.new(config)
- files =
- if options[:stdin_file_path]
- [{ file: STDIN, path: options[:stdin_file_path] }]
- else
- FileFinder.new(config).find(options[:files]).map do |file_path|
- { path: file_path }
- end
- end
+ files = files_to_lint(options, config)
runner.run(files)
report_lints(options, runner.lints, files)
if runner.lints.any?(&:error?)
halt :error
elsif runner.lints.any?
halt :warning
else
halt :ok
+ end
+ end
+
+ def files_to_lint(options, config)
+ if options[:stdin_file_path]
+ [{ file: STDIN, path: options[:stdin_file_path] }]
+ else
+ patterns = Array(options[:files]).any? ? Array(options[:files]) : config.scss_files
+ FileFinder.new(config).find(patterns).map do |file_path|
+ { path: file_path }
+ end
end
end
def handle_runtime_exception(exception, options) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/LineLength, Metrics/MethodLength
case exception