RuboCop Rails cops not working when different config location is used
We don't use the default location of the RuboCop config file: .rubocop.yml. Instead, we place it inside .config/.rubocop.yml and specify the config CLI option via --config .config/.rubocop.yml. However, in the latter case, RuboCop does not seem to acknowledge the Rails cops, e.g. compare (for these tests, I locally updated rubocop from 1.75.2 to 1.75.4 via bundle update rubocop):
# ./.config/.rubocop.yml
775 files inspected, 3 offenses detected, 3 offenses autocorrectable
# .rubocop.yml
775 files inspected, 141 offenses detected, 5 offenses autocorrectable
Note that for the latter, I adjusted the Style/MethodCallWithArgsParentheses Exclude pattern:
# ./.config/.rubocop.yml
Exclude: ["../db/**/*"]
# .rubocop.yml
Exclude: ["db/**/*"]
I've opened a respective issue for this here: https://github.com/rubocop/rubocop-rails/issues/1474, that was originally yet another issue where the cop Rails/EnumSyntax would work for a file placed in the app/ folder, but not for one in the lib/ folder. But in this context, I also stumbled upon this issue I describe here.
Note that I've also tried to specify
AllCops:
Include:
- "**/*.rb"
or even
AllCops:
Include:
- "../**/*.rb"
but this didn't help. And in both cases the same number of files is inspected, so the reason for this issue is probably a different one.
Still blocked via https://github.com/rubocop/rubocop-rails/issues/1521