lib/scss_lint/cli.rb in scss-lint-0.12.0 vs lib/scss_lint/cli.rb in scss-lint-0.12.1
- old
+ new
@@ -1,5 +1,6 @@
+require 'find'
require 'optparse'
module SCSSLint
# Responsible for parsing command-line options and executing the appropriate
# application logic based on the options specified.
@@ -78,12 +79,29 @@
private
def find_files
excluded_files = options.fetch(:excluded_files, [])
- SCSSLint.extract_files_from(options[:files]).reject do |file|
+ extract_files_from(options[:files]).reject do |file|
excluded_files.include?(file)
end
+ end
+
+ def extract_files_from(list)
+ files = []
+ list.each do |file|
+ Find.find(file) do |f|
+ files << f if scssish_file?(f)
+ end
+ end
+ files.uniq
+ end
+
+ VALID_EXTENSIONS = %w[.css .scss]
+ def scssish_file?(file)
+ return false unless FileTest.file?(file)
+
+ VALID_EXTENSIONS.include?(File.extname(file))
end
def report_lints(lints)
sorted_lints = lints.sort_by { |l| [l.filename, l.line] }
reporter = options.fetch(:reporter, Reporter::DefaultReporter).new(sorted_lints)