lib/scss_lint/runner.rb in scss-lint-0.25.1 vs lib/scss_lint/runner.rb in scss-lint-0.26.0
- old
+ new
@@ -1,7 +1,6 @@
module SCSSLint
- class LinterError < StandardError; end
class NoFilesError < StandardError; end
# Finds and aggregates all lints found by running the registered linters
# against a set of SCSS files.
class Runner
@@ -38,20 +37,25 @@
@linters.each do |linter|
next unless config.linter_enabled?(linter)
next if config.excluded_file_for_linter?(file, linter)
begin
- linter.run(engine, config.linter_options(linter))
+ run_linter(linter, engine, config)
rescue => error
- raise LinterError,
+ raise SCSSLint::Exceptions::LinterError,
"#{linter.class} raised unexpected error linting file #{file}: " \
"'#{error.message}'",
error.backtrace
end
end
rescue Sass::SyntaxError => ex
@lints << Lint.new(nil, ex.sass_filename, Location.new(ex.sass_line), ex.to_s, :error)
rescue FileEncodingError => ex
@lints << Lint.new(nil, file, Location.new, ex.to_s, :error)
+ end
+
+ # For stubbing in tests.
+ def run_linter(linter, engine, config)
+ linter.run(engine, config.linter_options(linter))
end
end
end