Sha256: 50b1f2558bc477d2e0611627ea2e11d49ada92c2b0b5ad8e4f9e6a437b70d51b

Contents?: true

Size: 794 Bytes

Versions: 3

Compression:

Stored size: 794 Bytes

Contents

module SCSSLint
  class Linter::DeclaredName < Linter
    include LinterRegistry

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

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

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

  private

    def check(node, node_type)
      if node_has_bad_name?(node)
        fixed_name = node.name.downcase.gsub(/_/, '-')

        add_lint(node, "Name of #{node_type} `#{node.name}` should " <<
                       "be written in lowercase as `#{fixed_name}`")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scss-lint-0.11.1 lib/scss_lint/linter/declared_name.rb
scss-lint-0.10.1 lib/scss_lint/linter/declared_name.rb
scss-lint-0.10.0 lib/scss_lint/linter/declared_name.rb