Sha256: 2bc7c66cf6b63e33048ba9bfc8f92678864192b055fcbd7c44166d8c5c62473a
Contents?: true
Size: 629 Bytes
Versions: 2
Compression:
Stored size: 629 Bytes
Contents
PuppetLint.new_check(:topscope_variable) do def check class_list = (class_indexes + defined_type_indexes) # do not check if the code is not part of a class return if class_list.first.nil? tokens.select { |x| x.type == :VARIABLE }.each do |token| next if token.value !~ /^::[a-z0-9_][a-zA-Z0-9_]+::/ fixed = token.value.sub(/^::/, '') notify( :warning, message: "use $#{fixed} instead of $#{token.value}", line: token.line, column: token.column, token: token ) end end def fix(problem) problem[:token].value.sub!(/^::/, '') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-lint-topscope-variable-check-1.2.0 | lib/puppet-lint/plugins/topscope_variable.rb |
puppet-lint-topscope-variable-check-1.1.0 | lib/puppet-lint/plugins/topscope_variable.rb |