Sha256: 2c587b24cbc6d0a845921ae0a39f738a6504ae8ba3d59087a1c186bccfaf3cf8
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
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, [])) @linters = LinterRegistry.linters.reject do |linter| ignored_linters.include?(linter) end.map do |linter_class| linter_class.new end 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
scss-lint-0.7.1 | lib/scss_lint/runner.rb |
scss-lint-0.7.0 | lib/scss_lint/runner.rb |
scss-lint-0.6.7 | lib/scss_lint/runner.rb |
scss-lint-0.6.6 | lib/scss_lint/runner.rb |