lib/scss_lint/file_finder.rb in scss-lint-0.35.0 vs lib/scss_lint/file_finder.rb in scss-lint-0.36.0

- old
+ new

@@ -20,12 +20,23 @@ # @param patterns [Array<String>] a list of file paths and glob patterns def find(patterns) # If no explicit patterns given, use patterns listed in config patterns = @config.scss_files if patterns.empty? - extract_files_from(patterns).reject do |file| - @config.excluded_file?(file) + matched_files = extract_files_from(patterns) + if matched_files.empty? + raise SCSSLint::Exceptions::NoFilesError, + "No SCSS files matched by the patterns: #{patterns.join(' ')}" end + + filtered_files = matched_files.reject { |file| @config.excluded_file?(file) } + if filtered_files.empty? + raise SCSSLint::Exceptions::AllFilesFilteredError, + "All files matched by the patterns [#{patterns.join(', ')}] " \ + "were excluded by the patterns: [#{@config.exclude_patterns.join(', ')}]" + end + + filtered_files end private # @param list [Array]