lib/puppet-lint/plugins/topscope_variable.rb in puppet-lint-topscope-variable-check-1.0.1 vs lib/puppet-lint/plugins/topscope_variable.rb in puppet-lint-topscope-variable-check-1.1.0

- old
+ new

@@ -1,12 +1,12 @@ 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? - 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}::/ + 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,