Sha256: 27f12871a8e1214beed443d98acc34de19e642f943038baec90391b895ae3833

Contents?: true

Size: 765 Bytes

Versions: 7

Compression:

Stored size: 765 Bytes

Contents

require 'scss_lint'
require 'sass'

module SCSSLint
  class NoFilesError < StandardError; end
  class NoLintersError < StandardError; end

  class Runner
    attr_reader :lints

    def run(files = [])
      @lints = []

      raise NoFilesError.new('No SCSS files specified') if files.empty?
      raise NoLintersError.new('No linters specified') if LinterRegistry.linters.empty?

      files.each do |file|
        find_lints(file)
      end
    end

    def find_lints(file)
      engine = Engine.new(file)

      LinterRegistry.linters.each do |linter|
        @lints += 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

7 entries across 7 versions & 1 rubygems

Version Path
scss-lint-0.5.2 lib/scss_lint/runner.rb
scss-lint-0.5.1 lib/scss_lint/runner.rb
scss-lint-0.5 lib/scss_lint/runner.rb
scss-lint-0.4 lib/scss_lint/runner.rb
scss-lint-0.3 lib/scss_lint/runner.rb
scss-lint-0.2 lib/scss_lint/runner.rb
scss-lint-0.1 lib/scss_lint/runner.rb