lib/scss_lint/linter/unnecessary_mantissa.rb in scss-lint-0.23.1 vs lib/scss_lint/linter/unnecessary_mantissa.rb in scss-lint-0.24.0
- old
+ new
@@ -14,25 +14,25 @@
end
end
def visit_script_number(node)
return unless match = REAL_NUMBER_REGEX.match(source_from_range(node.source_range))
+ return unless unnecessary_mantissa?(match[:mantissa])
- if unnecessary_mantissa?(match[:mantissa])
- add_lint(node, MESSAGE_FORMAT % [match[:number], match[:integer], match[:units]])
- end
+ add_lint(node, MESSAGE_FORMAT % [match[:number], match[:integer],
+ match[:units]])
end
private
- REAL_NUMBER_REGEX = %r{
+ REAL_NUMBER_REGEX = /
\b(?<number>
(?<integer>\d*)
\.
(?<mantissa>\d+)
(?<units>\w*)
)\b
- }ix
+ /ix
MESSAGE_FORMAT = '`%s` should be written without the mantissa as `%s%s`'
def unnecessary_mantissa?(mantissa)
mantissa !~ /[^0]/