Sha256: 5a84abcb5b85ccb225ae47dbae15712c0e1a0a0b4e2e53c76b6453e8664dd151
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
module SCSSLint class NoFilesError < StandardError; end class NoLintersError < StandardError; end class Runner attr_reader :linters, :lints def initialize(options = {}) @lints = [] included_linters = LinterRegistry. extract_linters_from(options.fetch(:included_linters, [])) 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? files.each do |file| find_lints(file) end linters.each do |linter| @lints += linter.lints end end def find_lints(file) engine = Engine.new(file) linters.each do |linter| linter.run(engine) end rescue Sass::SyntaxError => ex @lints << Lint.new(ex.sass_filename, ex.sass_line, ex.to_s) end def lints? lints.any? end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
scss-lint-0.10.1 | lib/scss_lint/runner.rb |
scss-lint-0.10.0 | lib/scss_lint/runner.rb |
scss-lint-0.9.0 | lib/scss_lint/runner.rb |