class SCSSLint::Linter::HexValidation
Checks for invalid hexadecimal colors.
Constants
- HEX_REGEX
Public Instance Methods
visit_script_string(node)
click to toggle source
# File lib/scss_lint/linter/hex_validation.rb, line 6 def visit_script_string(node) return unless node.type == :identifier node.value.scan(/(?:\W|^)(#\h+)(?:\W|$)/) do |match| check_hex(match.first, node) end end
Private Instance Methods
check_hex(hex, node)
click to toggle source
# File lib/scss_lint/linter/hex_validation.rb, line 18 def check_hex(hex, node) return if HEX_REGEX.match(hex) add_lint(node, "Colors must have either three or six digits: `#{hex}`") end