Sha256: 4031bed1417a247b0dd4687a413f87c531e49be5744aa6195863c146b0a1a686

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

module SCSSLint
  class Linter < Sass::Tree::Visitors::Base
    include Utils

    attr_reader :engine, :lints

    def initialize
      @lints = []
    end

    def run(engine)
      @engine = engine
      visit(engine.tree)
    end

    def description
      nil
    end

  protected

    # Helper for creating lint from a parse tree node
    def add_lint(node)
      @lints << Lint.new(engine.filename, node.line, description)
    end

    # Monkey-patched implementation that adds support for traversing
    # Sass::Script::Nodes (original implementation only supports
    # Sass::Tree::Nodes).
    def node_name(node)
      if node.is_a?(Sass::Script::Node)
        "script_#{node.class.name.gsub(/.*::(.*?)$/, '\\1').downcase}"
      else
        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.9.0 lib/scss_lint/linter.rb