Sha256: e376febdf061cc8cea762fd00631683159a9fa3ca0fedf72115f0a54bef3e415
Contents?: true
Size: 789 Bytes
Versions: 1
Compression:
Stored size: 789 Bytes
Contents
module SCSSLint class Linter::LeadingZero < Linter include LinterRegistry def visit_script_string(node) return unless node.type == :identifier non_string_values = remove_quoted_strings(node.value).split non_string_values.each do |value| if number = value[/\b(0\.\d+)/, 1] add_leading_zero_lint(node, number) end end end def visit_script_number(node) if node.original_string =~ /^0\./ add_leading_zero_lint(node, node.original_string) end end private def add_leading_zero_lint(node, number) trimmed_number = number[/^[^\.]+(.*)$/, 1] add_lint(node, "`#{number}` should be written without a leading zero " << "as `#{trimmed_number}`") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scss-lint-0.11.1 | lib/scss_lint/linter/leading_zero.rb |