camptocamp/puppet-lint-leading_zero-check

View on GitHub
lib/puppet-lint/plugins/check_leading_zero.rb

Summary

Maintainability
A
25 mins
Test Coverage
PuppetLint.new_check(:leading_zero) do
  def check
    tokens.each do |token|
      next unless token.type == :NUMBER and token.value =~ /^0\d/

      notify :warning, {
        message: 'unquoted number with leading zero',
        line: token.line,
        column: token.column,
        token: token,
      }
    end
  end

  def fix(problem)
    problem[:token].type = :SSTRING
  end
end