diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /doc/development/module_with_instance_variables.md | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'doc/development/module_with_instance_variables.md')
-rw-r--r-- | doc/development/module_with_instance_variables.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/development/module_with_instance_variables.md b/doc/development/module_with_instance_variables.md index 16c7a807053..f298b603429 100644 --- a/doc/development/module_with_instance_variables.md +++ b/doc/development/module_with_instance_variables.md @@ -68,7 +68,7 @@ objects are touching them, then it would be an acceptable use. We especially allow the case where a single instance variable is used with `||=` to set up the value. This would look like: -``` ruby +```ruby module M def f @f ||= true @@ -85,7 +85,7 @@ we could easily add to the cop, we should do it. Even if we could just disable the cop, we should avoid doing so. Some code could be easily rewritten in simple form. Consider this acceptable method: -``` ruby +```ruby module Gitlab module Emoji def emoji_unicode_version(name) @@ -104,7 +104,7 @@ cop is not smart enough to judge that this is fine. On the other hand, we could split this method into two: -``` ruby +```ruby module Gitlab module Emoji def emoji_unicode_version(name) @@ -127,7 +127,7 @@ Now the cop doesn't complain. Put the disabling comment right after your code in the same line: -``` ruby +```ruby module M def violating_method @f + @g # rubocop:disable Gitlab/ModuleWithInstanceVariables @@ -137,7 +137,7 @@ end If there are multiple lines, you could also enable and disable for a section: -``` ruby +```ruby module M # rubocop:disable Gitlab/ModuleWithInstanceVariables def violating_method @@ -167,13 +167,13 @@ point of view), making it extremely hard to track data dependency. We're trying to use something like this instead: -``` haml +```haml = render 'projects/commits/commit', commit: commit, ref: ref, project: project ``` And in the partial: -``` haml +```haml - ref = local_assigns.fetch(:ref) - commit = local_assigns.fetch(:commit) - project = local_assigns.fetch(:project) |