summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-11-22 16:34:52 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-11-22 17:06:57 +0800
commit166a2d7a67787d3cf8cebb1e75fc557e2409e669 (patch)
tree498476208a8c10d1ab792a237ccf1f9d9f76e794
parent89f29395259326793435044261641f5571e718d0 (diff)
downloadgitlab-ce-166a2d7a67787d3cf8cebb1e75fc557e2409e669.tar.gz
Make it clear that this is an acceptable use
-rw-r--r--doc/development/module_with_instance_variables.md13
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/development/module_with_instance_variables.md b/doc/development/module_with_instance_variables.md
index ff8d4dacd11..48a1b7f847e 100644
--- a/doc/development/module_with_instance_variables.md
+++ b/doc/development/module_with_instance_variables.md
@@ -77,8 +77,7 @@ we could easily add to the cop, we should do it.
### How to rewrite and avoid disabling this cop
Even if we could just disable the cop, we should avoid doing so. Some code
-could be easily rewritten in simple form. Here's an example. Consider this
-acceptable method:
+could be easily rewritten in simple form. Consider this acceptable method:
``` ruby
module Gitlab
@@ -92,8 +91,12 @@ module Gitlab
end
```
-It's still offending because it's not just `||=`, but we could split this
-method into two:
+This method is totally fine because it's already self-contained. No other
+methods should be using `@emoji_unicode_versions_by_name` and we're good.
+However it's still offending the cop because it's not just `||=`, and the
+cop is not smart enough to judge that this is fine.
+
+On the other hand, we could split this method into two:
``` ruby
module Gitlab
@@ -112,7 +115,7 @@ module Gitlab
end
```
-Now the cop won't complain. Here's another bad example which we could rewrite:
+Now the cop won't complain. Here's a bad example which we could rewrite:
``` ruby
module SpamCheckService