Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
15edf741
Commit
15edf741
authored
Nov 22, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explain how to disable it in the doc
parent
0b6d01ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
doc/development/module_with_instance_variables.md
doc/development/module_with_instance_variables.md
+29
-0
rubocop/cop/module_with_instance_variables.rb
rubocop/cop/module_with_instance_variables.rb
+0
-3
No files found.
doc/development/module_with_instance_variables.md
View file @
15edf741
...
...
@@ -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
...
...
rubocop/cop/module_with_instance_variables.rb
View file @
15edf741
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment