lib/scss_lint/linter/leading_zero.rb in scss-lint-0.23.1 vs lib/scss_lint/linter/leading_zero.rb in scss-lint-0.24.0
- old
+ new
@@ -5,15 +5,13 @@
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[FRACTIONAL_DIGIT_REGEX, 1]
- check_number(node, number)
- end
+ next unless number = value[FRACTIONAL_DIGIT_REGEX, 1]
+ check_number(node, number)
end
end
def visit_script_number(node)
return unless number = source_from_range(node.source_range)[FRACTIONAL_DIGIT_REGEX, 1]
@@ -39,14 +37,12 @@
}
def check_number(node, original_number)
style = config.fetch('style', 'exclude_zero')
convention = CONVENTIONS[style]
+ return if convention[:validator].call(original_number)
- unless convention[:validator].call(original_number)
- corrected = convention[:converter].call(original_number)
-
- add_lint(node, convention[:explanation] % [original_number, corrected])
- end
+ corrected = convention[:converter].call(original_number)
+ add_lint(node, convention[:explanation] % [original_number, corrected])
end
end
end