How to tell Rubocop to ignore a specific directory or file

emery picture emery · Apr 27, 2016 · Viewed 42.7k times · Source

My project is extending open-source classes from a third-party gem that we don't want to hold to the same coding standards as our own code. Refactoring the gem code isn't a viable option. We just want Rubocop to ignore the copied code.

How can I instruct Rubocop to completely ignore a file or directory?

Answer

emery picture emery · Apr 27, 2016

As per orde's comment with the link to the manual I found .rubocop.yml and added the following:

AllCops:
  Exclude:
    - 'path/to/excluded/file.rb'

where the path is relative to .rubocop.yml