class Object
Public Instance Methods
check()
click to toggle source
# File lib/puppet-lint/plugins/topscope_variable.rb, line 2 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? class_name = class_list.first[:name_token].value.split('::').first tokens.select { |x| x.type == :VARIABLE }.each do |token| next if token.value !~ /^::#{class_name}::/ fixed = token.value.sub(/^::/, '') notify( :warning, message: "use $#{fixed} instead of $#{token.value}", line: token.line, column: token.column, token: token ) end end
fix(problem)
click to toggle source
# File lib/puppet-lint/plugins/topscope_variable.rb, line 20 def fix(problem) problem[:token].value.sub!(/^::/, '') end