summaryrefslogtreecommitdiff
path: root/doc/development
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-11-22 00:59:16 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-11-22 17:06:57 +0800
commit15edf741a14a53443fb39ecb59888e75697b9c2b (patch)
tree8d9acc47f7c08bae32d13bda497ecd100a4e2319 /doc/development
parent0b6d01ed775e957161e1304de44d0bd5251f4098 (diff)
downloadgitlab-ce-15edf741a14a53443fb39ecb59888e75697b9c2b.tar.gz
Explain how to disable it in the doc
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/module_with_instance_variables.md29
1 files changed, 29 insertions, 0 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