Sha256: b78ccff0068329b8a83a0136a62cea3ed20890149588f41d86c32a6dacf9b653

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

PuppetLint.new_check(:empty_string_assignment) do
  def check
    tokens.each_with_index do |token, token_idx|
      if token.type == :SSTRING && token.prev_code_token.type == :EQUALS && \
         token.value == ''

        notify :warning, {
          :message => 'variable assigned to the empty string',
          :line    => token.line,
          :column  => token.column,
          :token   => token,
        }
      end
    end
  end

  def fix(problem)
    problem[:token].type = :UNDEF
    problem[:token].value = 'undef'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppet-lint-empty_string-check-1.0.0 lib/puppet-lint/plugins/check_empty_string_assignment.rb
puppet-lint-empty_string-check-0.2.2 lib/puppet-lint/plugins/check_empty_string_assignment.rb
puppet-lint-empty_string-check-0.2.1 lib/puppet-lint/plugins/check_empty_string_assignment.rb