Skip to content

Commit

Permalink
rubocop: Set inherit_mode: merge for Excludes
Browse files Browse the repository at this point in the history
- We found that for apps that used Ruby-only cops, the recent changes in
  gem version 3.1.0 to exclude `bin/` files from linting worked fine.
- For apps that used Rails cops as well, the changes didn't work for
  `bin/` but they did work for `db/schema.rb` which is excluded from
  linting in `config/rails.yml`.
- This is because RuboCop by default *overwrites* any previous
  definitions of a config option when it detects a later one:
  https://rubocop.readthedocs.io/en/latest/configuration/#merging-arrays-using-inherit_mode.
- Unfortunately, we'll have to specify this `inherit_mode` stanza in
  every app.

https://trello.com/c/i72oq9Xa/1810-fix-rubocop-config-file-inheritance-in-all-the-apps
  • Loading branch information
issyl0 committed Mar 9, 2020
1 parent c5a6f6d commit 37b0c47
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ inherit_gem:
- "config/default.yml"
- "config/rails.yml"

inherit_mode:
merge:
- Exclude

Metrics/BlockLength:
Exclude:
- "test/**/*_test.rb"
Expand Down

0 comments on commit 37b0c47

Please sign in to comment.