Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/development/module_with_instance_variables.md29
-rw-r--r--rubocop/cop/module_with_instance_variables.rb3
2 files changed, 29 insertions, 3 deletions
diff --git a/doc/development/module_with_instance_variables.md b/doc/development/module_with_instance_variables.md
index 43ec8911b81..1c64b35b782 100644
--- a/doc/development/module_with_instance_variables.md
+++ b/doc/development/module_with_instance_variables.md
@@ -178,6 +178,35 @@ rather than whatever includes the module, and those modules which were also
included, making it much easier to track down any issues,
and reducing the chance of having name conflicts.
+### How to disable this cop
+
+Put the disabling comment right after your code in the same line:
+
+``` ruby
+module M
+ def violating_method
+ @f + @g # rubocop:disable Cop/ModuleWithInstanceVariables
+ end
+end
+```
+
+If there are multiple lines, you could also enable and disable for a section:
+
+``` ruby
+module M
+ # rubocop:disable Cop/ModuleWithInstanceVariables
+ def violating_method
+ @f = 0
+ @g = 1
+ @h = 2
+ end
+ # rubocop:enable Cop/ModuleWithInstanceVariables
+end
+```
+
+Note that you need to enable it at some point, otherwise everything below
+won't be checked.
+
### Things we might need to ignore right now
Because of the way Rails helpers and mailers work, we might not be able to
diff --git a/rubocop/cop/module_with_instance_variables.rb b/rubocop/cop/module_with_instance_variables.rb
index 9f9856e308b..f101ae09ad2 100644
--- a/rubocop/cop/module_with_instance_variables.rb
+++ b/rubocop/cop/module_with_instance_variables.rb
@@ -6,9 +6,6 @@ module RuboCop
for the rationale behind it:
https://docs.gitlab.com/ee/development/module_with_instance_variables.html
-
- If you think the use for this is fine, please just add:
- # rubocop:disable Cop/ModuleWithInstanceVariables
EOL
def on_module(node)