This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.
Note that backreferences like $1, $2, etc are not global variables.
predefined global variables their English aliases www.zenspider.com/Languages/Ruby/QuickRef.html
# File lib/rubocop/cop/style/global_vars.rb, line 53 def allowed_var?(global_var) BUILT_IN_VARS.include?(global_var) || user_vars.include?(global_var) end
# File lib/rubocop/cop/style/global_vars.rb, line 65 def check(node) global_var, = *node add_offense(node, :name) unless allowed_var?(global_var) end
# File lib/rubocop/cop/style/global_vars.rb, line 57 def on_gvar(node) check(node) end
Generated with the Darkfish Rdoc Generator 2.