lib/scss_lint/runner.rb in scss-lint-0.7.1 vs lib/scss_lint/runner.rb in scss-lint-0.9.0

- old
+ new

@@ -1,25 +1,23 @@ -require 'scss_lint' -require 'sass' - module SCSSLint class NoFilesError < StandardError; end class NoLintersError < StandardError; end class Runner attr_reader :linters, :lints def initialize(options = {}) @lints = [] - ignored_linters = LinterRegistry. - extract_linters_from(options.fetch(:ignored_linters, [])) + included_linters = LinterRegistry. + extract_linters_from(options.fetch(:included_linters, [])) - @linters = LinterRegistry.linters.reject do |linter| - ignored_linters.include?(linter) - end.map do |linter_class| - linter_class.new - end + included_linters = LinterRegistry.linters if included_linters.empty? + + excluded_linters = LinterRegistry. + extract_linters_from(options.fetch(:excluded_linters, [])) + + @linters = (included_linters - excluded_linters).map(&:new) end def run(files = []) raise NoFilesError.new('No SCSS files specified') if files.empty? raise NoLintersError.new('No linters specified') if linters.empty?