lib/scss_lint/linter/hex_format.rb in scss-lint-0.19.0 vs lib/scss_lint/linter/hex_format.rb in scss-lint-0.20.0
- old
+ new
@@ -2,13 +2,13 @@
# Checks for hexadecimal colors that can be shortened.
class Linter::HexFormat < Linter
include LinterRegistry
def visit_script_color(node)
- return unless node.original_string && node.original_string.match(HEX_REGEX)
+ return unless color = source_from_range(node.source_range)[HEX_REGEX, 1]
- unless valid_hex_format?(node.original_string[HEX_REGEX, 1])
- add_hex_lint(node, node.original_string)
+ unless valid_hex_format?(color)
+ add_hex_lint(node, color)
end
end
def visit_script_string(node)
return unless node.type == :identifier