Sha256: e008f9800e0048367dca138e79ad2ef83c18232fd07b78059ff4546ef379276c

Contents?: true

Size: 968 Bytes

Versions: 2

Compression:

Stored size: 968 Bytes

Contents

require 'sass'

module SCSSLint
  class Linter::DeclaredNameLinter < Linter
    include LinterRegistry

    def visit_function(node)
      check(node)
      yield # Continue into content block of this function definition
    end

    def visit_mixin(node)
      check(node)
      yield # Continue into content block of this mixin's block
    end

    def visit_mixindef(node)
      check(node)
      yield # Continue into content block of this mixin definition
    end

    def visit_variable(node)
      check(node)
      yield # Continue into expression tree for this variable definition
    end

    def visit_script_funcall(node)
      check(node)
    end

    def visit_script_variable(node)
      check(node)
    end

    def description
      'Names of variables, functions, and mixins should be lowercase and not contain underscores. Use hyphens instead.'
    end

  private

    def check(node)
      add_lint(node) if node.name =~ /[_A-Z]/
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scss-lint-0.7.1 lib/scss_lint/linter/declared_name_linter.rb
scss-lint-0.7.0 lib/scss_lint/linter/declared_name_linter.rb