Class: SCSSLint::Linter::NameFormat

Inherits:
SCSSLint::Linter
  • Object
show all
Includes:
SCSSLint::LinterRegistry
Defined in:
lib/scss_lint/linter/name_format.rb

Overview

Checks the format of declared names of functions, mixins, variables, and placeholders.

Constant Summary

Constants included from Utils

Utils::COLOR_REGEX

Instance Attribute Summary

Attributes inherited from SCSSLint::Linter

#config, #engine, #lints

Instance Method Summary collapse

Methods included from SCSSLint::LinterRegistry

extract_linters_from, included

Methods inherited from SCSSLint::Linter

#initialize, #name, #run

Methods included from Utils

#color?, #color_hex?, #color_keyword?, #color_keyword_to_code, #extract_string_selectors, #node_ancestor, #node_siblings, #pluralize, #previous_node, #remove_quoted_strings, #same_position?

Methods included from SelectorVisitor

#visit_selector

Constructor Details

This class inherits a constructor from SCSSLint::Linter

Instance Method Details

#visit_extend(node) ⇒ Object



7
8
9
# File 'lib/scss_lint/linter/name_format.rb', line 7

def visit_extend(node)
  check_placeholder(node)
end

#visit_function(node) ⇒ Object



11
12
13
14
# File 'lib/scss_lint/linter/name_format.rb', line 11

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

#visit_mixin(node) ⇒ Object



16
17
18
19
# File 'lib/scss_lint/linter/name_format.rb', line 16

def visit_mixin(node)
  check_name(node, 'mixin') unless FUNCTION_WHITELIST.include?(node.name)
  yield # Continue into content block of this mixin's block
end

#visit_mixindef(node) ⇒ Object



21
22
23
24
# File 'lib/scss_lint/linter/name_format.rb', line 21

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

#visit_script_funcall(node) ⇒ Object



26
27
28
# File 'lib/scss_lint/linter/name_format.rb', line 26

def visit_script_funcall(node)
  check_name(node, 'function') unless FUNCTION_WHITELIST.include?(node.name)
end

#visit_script_variable(node) ⇒ Object



30
31
32
# File 'lib/scss_lint/linter/name_format.rb', line 30

def visit_script_variable(node)
  check_name(node, 'variable')
end

#visit_variable(node) ⇒ Object



34
35
36
37
# File 'lib/scss_lint/linter/name_format.rb', line 34

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