How can I ignore certain Rubocop errors? I am trying to ignore this one for example:
Method has too many lines. [11/10]
Is there a way to reference that error in some dot file? Note that I am running it in Emacs using Flycheck.
Thanks,
See the chapters Configuration and Disabling Cops within Source Code on the README page.
To see the name of the cop reporting an offense, use the -D option when running rubocop. I also recommend the --auto-gen-config option for automatic generation of configuration to ignore the error.
For reference, if anyone else stumbles upon this, the name of the cop is MethodLength.
You can disable it in the code with:
# rubocop:disable MethodLength
def foo
# ...
end
For further reference, the new link for "Disabling Cops Within Source Code" in @jonas054's post is here
For reference, if anyone else stumbles upon this, the name of the cop is
MethodLength.You can disable it in the code with:
# rubocop:disable MethodLength def foo # ... end
Thanks. It works. In the end of method we also need to add comment # rubocop:enable MethodLength
Most helpful comment
For reference, if anyone else stumbles upon this, the name of the cop is
MethodLength.You can disable it in the code with: