Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I exclude a global variable from rubocop?

I want to exclude a global variable from rubocop but I'm not being able to find the rule name. I tried adding

GlobalVars:
  Exclude:
    - redis

to .rubocop.yml but no luck.

The error says Do not introduce global variables.

like image 337
Leticia Esperon Avatar asked May 16 '17 14:05

Leticia Esperon


2 Answers

Switch Exclude with AllowedVariables.

like image 186
michaeltomer Avatar answered Sep 23 '22 00:09

michaeltomer


in .rubocop.yml:

GlobalVars:
  AllowedVariables:
    - $redis

Note that the variable name requires the leading dollar sign.

like image 38
Jaime Bellmyer Avatar answered Sep 21 '22 00:09

Jaime Bellmyer